grass-dbf(1grass)

๐Ÿ’พ DBF DATABASE DRIVER ๐Ÿ’พ

okay bestie, come CLOSE. this is the manual page for grass-dbf(1grass) and honestly? it's giving "humble little file-based king" energy ๐Ÿ‘‘โœจ

The DBF driver is a file based attribute table driver. that's the whole vibe. it's not out here trying to be a whole SQL engine, it's just files being files. ๐Ÿ—‚๏ธ


๐Ÿ› ๏ธ Defining the DBF driver

The DBF driver is a file based driver, so in theory no user interaction is required ๐Ÿ’… like, it just does its thing.

BUT. plot twist. ๐Ÿซข if your settings need to be switched back from a different driver over to the DBF driver, you gotta do this one step:

# keep single quotes:
db.connect driver=dbf database=โ€™$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/โ€™
db.connect -p
bestie, fr fr โ€” keep the single quotes. the comment in the code says it, i'm saying it, we're all saying it. ๐Ÿ™

Also important, no cap: the dbf/ subdirectory inside the mapset must exist or must be created by the user. it will not manifest itself for you, that's a you job ๐ŸŽ€


โœจ Creating a DBF table โœจ

DBF tables get created by GRASS when you're generating a vector map with attributes and you've got the DBF set as the attribute driver. automatic. iconic. ๐Ÿ‘‘

If you need to create a DBF table manually though, you've got options:

  • db.execute can be used
  • a spreadsheet application works too
  • db.copy is sometimes useful as well
  • and db.in.ogr is the move for importing external tables ๐ŸŒ

๐Ÿ“œ Supported SQL commands by DBF driver

here's the whole menu, bestie โ€” no substitutions:

ALTER TABLE table ADD [COLUMN] columndef
ALTER TABLE table DROP COLUMN colname
CREATE TABLE table ( columndefs )
DROP TABLE table
SELECT columns FROM table
SELECT columns FROM table WHERE condition
SELECT columns FROM table ORDER BY column
DELETE FROM table
DELETE FROM table WHERE condition
INSERT INTO table VALUES (value1[,value2,...])
INSERT INTO table ( column1[,column2,...] ) VALUES (value1[,value2,...])
UPDATE table SET assignment1[,assignment2,...]
UPDATE table SET assignment1[,assignment2,...] WHERE condition

๐Ÿงฎ Operators available in conditions

  • "=" โ€” equal
  • "<" โ€” smaller than
  • "<=" โ€” smaller/equal than
  • ">" โ€” larger than
  • ">=" โ€” larger/equal than
  • "<>" โ€” not equal
  • "~" โ€” Substring matching (non-standard SQL)
  • "%" โ€” Substring matching (limited functionality)

Arithmetic expressions using constants and field values are allowed in condition clauses and in the RHS of assignments. ๐Ÿง 

Usual precedence rules and bracketing (using โ€™(โ€™ and โ€™)โ€™) are supported. Type conversion is performed if necessary (experimental) โ€” so like, it works, but it's in its experimental era, treat it gently ๐Ÿซถ

Conditions allow boolean expressions using the AND, OR and NOT operators, with the usual precedence rules. ๐Ÿ”ฅ

NULLs can be tested by โ€™colname IS NULLโ€™ in conditions. The negation is โ€™colname NOT NULLโ€™.

Sorting: Empty fields in a character column are sorted to the end. ๐Ÿ“‹


๐Ÿšง LIMITATIONS OF THE DBF DRIVER ๐Ÿšง

okay so real talk. the DBF driver supports only a few SQL statements, since the DBF tables are intended for simple table storage. it's a simple gal living a simple life. ๐ŸŒธ

Also DBF column names are limited to 10 characters (as defined in the DBF specifications). ten. that's it. that's the budget. ๐Ÿ’€

For example:

  • aggregate functions (sum, count, min, max,...) are not supported in SELECT clauses;
  • mathematic functions (sin, cos, exp, log,...) are not supported in expressions;
  • SQL query with IN are not supported.

๐Ÿ˜ญ ERROR MESSAGES ๐Ÿ˜ญ

if you see an error message such as:

DBMI-DBF driver error:
SQL parser error: syntax error, unexpected NAME processing โ€™INโ€™..

that means an unsupported SQL statement (here, โ€™INโ€™) was used. ๐Ÿซ  The only solution is to switch the DBMI backend to a real SQL engine (SQLite, PostgreSQL, MySQL etc.). See SQL support in GRASS.

and if you see an error message such as:

DBMI-DBF driver error:
SQL parser error: syntax error, unexpected DESC, expecting NAME processing โ€™DESCโ€™

that means a column name corresponds to a reserved SQL word (here: โ€™DESCโ€™). ๐Ÿ™ˆ A different column name should be used. If this happens during import with v.in.ogr, the cnames parameter can be used to assign different column names on the fly. slay, problem solved ๐Ÿ’…


๐Ÿ‘€ SEE ALSO

  • db.connect
  • SQL support in GRASS
  • DBF Specifications (Shapelib)

๐Ÿ“ฆ SOURCE CODE

Available at: DBF DATABASE DRIVER source code (history)

Accessed: Tuesday Sep 08 11:54:02 2026

Main index | Topics index | Keywords index | Graphical index | Full index


and that's the whole page bestie, we ate and left no crumbs ๐Ÿ“โœจ go forth and query responsibly. the DBF driver is a file based attribute table driver and now you know everything it does and doesn't do, periodt. ๐Ÿ’œ

ยฉ 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual โ€” literally the whole squad, GRASS 8.5.0 era, accessed Tuesday Sep 08 11:54:02 2026, and this little page lives at the footer label GRASS 8.5.0 grass-dbf(1grass). bye babes ๐Ÿ’–๐Ÿฆ‹๐ŸŽ€

๐Ÿ“ฆ where this page comes from