grass-sqlite(1)

πŸ’– grass-sqlite(1) β€” the GRASS GIS User's Manual glow-up πŸ’–

okay bestie, sit down, hydrate, and let me tell you about the SQLite DATABASE DRIVER πŸ¦‹ because this one is genuinely the moment.

The SQLite driver is the default DBMI backend. yeah. the default. it's giving main character energy and it didn't even have to audition πŸ‘‘


✨ Creating a SQLite database ✨

GRASS is automatically creating the SQLite database if it is not yet existing when the first table is created in the SQLite database. that's right, it just does it for you, no cap 🫢

It is sufficient to define the connection (see next step). literally that's it, that's the whole task πŸ’…


🌸 Connecting GRASS to SQLite 🌸

The database name sqlite.db is at user's choice. pick your own name, go feral, live your truth ✨

Also the file storage location can be freely chosen. anywhere you want, bestie, the world is yours 🌈

If the database does not exist, it will be automatically created when database content is created. so like… don't stress about it not being there yet, it'll show up when it's needed πŸ’–

# example for storing DB in mapset directory (keep single quotes):
db.connect driver=sqlite database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
db.connect -p
keep the single quotes fr fr, they are load-bearing πŸ™ˆ

and then db.connect -p to peek at your connection and vibe check it βœ…


πŸŽ€ Supported SQL commands πŸŽ€

All SQL commands supported by SQLite πŸ’… (for limitations, see SQLite help page: SQL As Understood By SQLite and Unsupported SQL).

like. all of them. well, all the ones SQLite supports β€” check those two pages if you need the fine print, iykyk πŸ“–


⭐ Operators available in conditions ⭐

All SQL operators supported by SQLite. yes queen, the whole set πŸ”₯


πŸ¦‹ Browsing table data in DB πŸ¦‹

A convenient SQLite front-end is sqlitebrowser. it's cute, it's visual, it's obsessed with you πŸ₯°

To open a DB file stored within the current mapset, the following way is suggested (corresponds to above database connection):

# fetch GRASS variables as shell environment variables:
eval `g.gisenv`
# use double quotes:
sqlitebrowser "$GISDBASE/$LOCATION_NAME/$MAPSET"/sqlite/sqlite.db
note the plot twist: backticks on g.gisenv to pull those GRASS variables into your shell env, then double quotes for the path πŸŽ€ the quotes change and honestly? iconic of them.

πŸ’œ SEE ALSO πŸ’œ

  • db.connect
  • db.execute
  • db.select
  • SQL support in GRASS GIS
  • SQLite web site
  • SQLite manual
  • sqlite - Management Tools

πŸ‘‘ SOURCE CODE πŸ‘‘

Available at: SQLite 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, you ate it up πŸ’…

Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual

GRASS 8.4.2 β€” grass-sqlite(1) πŸ¦‹ mwah, go create some tables, you've got this πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from