databaseintro(1)
π databaseintro(1) β Database management in GRASS GIS π
okay bestie, welcome to the databaseintro page from the GRASS GIS User's Manual β¨ this is your whole group-chat rundown of how databases work in GRASS, and I'm gonna tell you everything, no skips, no gatekeeping π«Ά
πΈ Attribute management in general πΈ
GRASS can be linked to one or many database management systems (DBMS). The db.* set of commands gives you basic SQL support for attribute management, and the v.db.* set of commands is the one that operates on the vector map (peep the Vector introduction for that vibe).
π Available drivers π
The available drivers are listed in SQL support in GRASS GIS. slay, go look π
Notes, bestie, read these:
- The DBF driver only gives you very limited SQL support (because DBF is not an SQL DB, it's giving poser energy ngl), while the other DBMS backends (like SQLite, PostgreSQL, MySQL etc) give you full SQL support, since the SQL commands are sent directly to the DBMS. For this reason, the SQLite driver is the default DBMI backend. periodt.
π¦ DB connection management π¦
Your current database management settings are shown or modified with db.connect, and that's for the current mapset, iykyk. Available DBMI drivers are listed with db.drivers. Some DBMI backends need a user/password for driver/database to be set with db.login. And if you wanna test a driver, run db.test π
π Attribute data import and export π
Attribute data can be imported with db.in.ogr from various formats, and exported with db.out.ogr. And to internally copy a full table, or selectively parts of it, use db.copy.
Further conversion tools, bestie:
- MDB Tools: Convert MS-Access data to SQL, DBF, etc.
- Using OpenOffice.org with SQL Databases
β SQL commands β
GRASS supports two main SQL operations: execution of an SQL statement (db.execute) and selection of data from a table (db.select). See the SQL help page for examples β¨
π Managing the default DBMI settings π
Per default, vector map attributes are stored in SQLite tables. This default definition can be modified with db.connect. If an external DBMS is used, db.login may be required. lowkey important, don't forget it π
π§ Creating a database π§
Specific commands are explained on the individual driver pages β and heads up, those pages are only available if the driver was compiled in this installation:
- DBF: see DBF page
- SQLite: SQLite page
- mySQL: mySQL and meSQL pages
- ODBC: ODBC page (connect to Oracle, etc.)
- PostgreSQL: PostgreSQL and PostGIS page
π Metadata π
All columns for a given table are listed with db.columns. The command db.describe describes a table in detail. And to list all available tables for a given database, run db.tables. so much info, obsessed π
π Table maintenance π
To drop a column from a selected attribute table, use db.dropcolumn. With db.droptable, an attribute table can be deleted. bye bye table π
π Database Schema π
Currently, schema support only works for PostgreSQL connections. Default schema can be set with db.connect. Note that the default schema will be used by all db.* modules.
db.tables returns 'schema.table' if schemas are available in the database.
π Migrating to a different database engine π
To migrate a GRASS database table (or a GRASS vector map) to a different DBMI engine, the best solution is:
- Create a new
MAPSET. - Define the DBMI settings accordingly with
db.connect, and if needed,db.login. - Then the table of interest can be copied over with
db.copyfrom the originalMAPSET.
Likewise, a vector map including its table(s) are copied from the original MAPSET to the current MAPSET with g.copy. main character migration arc fr fr π¦
π See also π
- Introduction into raster data processing
- Introduction into 3D raster data (voxel) processing
- Introduction into vector data processing
- Introduction into image processing
- Introduction into temporal data processing
- Projections and spatial transformations
- Graphical User Interface
β¨ SOURCE CODE β¨
Available at: Database management in GRASS GIS source code (history)
Accessed: Friday Nov 21 14:02:57 2025
Main index | Database index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's the whole page bestie, mwah π this was GRASS 8.4.2, databaseintro(1), the GRASS Development Team's 2003-2025 copyright era, accessed Friday Nov 21 14:02:57 2025 β iconic, no cap, go manage those databases π
β¨
π¦ 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