grass-dbf(1)
π DBF DATABASE DRIVER π
okay so first things first bestie, this is grass-dbf(1) β a page from the GRASS GIS User's Manual β¨ and it's all about the DBF driver, which is a file based attribute table driver. that's the whole vibe. let's get into it π«Ά
πΈ Defining the DBF driver πΈ
so the DBF driver is a file based driver, which means in theory you don't have to do anything β no user interaction required, she just works π
BUT. if your settings are currently pointed at a different driver and you need to bring them back to DBF, you gotta do this one little step:
# keep single quotes:
db.connect driver=dbf database=β$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/β
db.connect -p
β οΈ and listen β that dbf/ subdirectory inside the mapset must already exist or must be created by the user. it will not manifest itself out of thin air, no cap.
π Creating a DBF table π
when does a DBF table even get born? GRASS makes them when you generate a vector map that has attributes, as long as you've defined DBF as your attribute driver. iconic behavior honestly β¨
and if you need to create a DBF table manually? you've got options bestie:
db.executeβ the classic- a spreadsheet application β yes, for real
db.copyβ sometimes useful, lowkey underrateddb.in.ogrβ for importing external tables π¦
π Supported SQL commands by DBF driver π
here's the whole roster, exactly as she serves it:
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 β¨
the mood board of operators:
"="β equal"<"β smaller than"<="β smaller/equal than">"β larger than">="β larger/equal than"<>"β not equal"~"β Substring matching (non-standard SQL)"%"β Substring matching (limited functionality)
a few extra notes so you don't get caught out π
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). experimental!! just so you know π
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. that's just where they go, periodt π
π LIMITATIONS OF THE DBF DRIVER π
okay this is the part where we keep it real. the DBF driver supports only a few SQL statements, because DBF tables are intended for simple table storage. and DBF column names are limited to 10 characters (as defined in the DBF specifications). for example:
- aggregate functions (
sum,count,min,max,...) are not supported inSELECTclauses; - mathematic functions (
sin,cos,exp,log,...) are not supported in expressions; - SQL query with
INare not supported.
π ERROR MESSAGES π
if you see something like this:
DBMI-DBF driver error:
SQL parser error: syntax error, unexpected NAME processing βINβ..
that means you used an unsupported SQL statement (here, βINβ). the only solution is to switch the DBMI backend to a real SQL engine (SQLite, PostgreSQL, MySQL etc.). See SQL support in GRASS GIS. π§
and if you see something like this:
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. and if this happens during import with v.in.ogr, the cnames parameter can be used to assign different column names on the fly. slay π«Ά
π SEE ALSO π
db.connect- SQL support in GRASS GIS
- DBF Specifications (Shapelib)
β SOURCE CODE β
Available at: DBF DATABASE DRIVER source code (history)
Accessed: Saturday Jan 17 05:40:32 2026
Main index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page bestie, no notes π this was GRASS GIS 8.4.2 Reference Manual, Β© 2003-2025 GRASS Development Team, version 8.4.2, accessed Saturday Jan 17 05:40:32 2026 β go build something cute with it β¨π
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms