grass-sqlite(1grass)

πŸ’– SQLite DATABASE DRIVER πŸ’–

okay bestie, lemme put you on πŸ’… this is grass-sqlite, and it's literally the default DBMI backend. the main character, no cap. πŸ‘‘


✨ Creating a SQLite database ✨

so here's the tea πŸ“: GRASS will automatically create the SQLite database for you if it doesn't exist yet β€” this happens the moment the first table gets created in the SQLite database. like, you don't gotta do a thing. it's giving self-sufficient. πŸ¦‹

all you actually need to do is define the connection (that's literally the next step, keep scrolling babe πŸ‘‡).


🌸 Connecting GRASS to SQLite 🌸

the database name β€” 'sqlite.db' β€” is your choice, queen. pick whatever. and the file storage location? also totally up to you, go off. πŸŽ€

and if the database doesn't exist yet? don't stress, it gets automatically created when database content is created:

# 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
⚠️ okay important: keep those single quotes in that db.connect line, fr fr. note also that the second command uses -p β€” yes that's the flag, exactly like that.

πŸ”₯ Supported SQL commands πŸ”₯

all the SQL commands that SQLite supports. all of them. periodt. πŸ’…

(for the limitations tho, go check the SQLite help page: SQL As Understood By SQLite and Unsupported SQL β€” iykyk)


⭐ Operators available in conditions ⭐

all the SQL operators that SQLite supports. every single one. slay. ✨


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

a convenient SQLite front-end is sqlitebrowser. icon behavior honestly. πŸ’œ

to open a DB file that lives inside the current mapset, here's the suggested way (and yes this corresponds to that database connection from up above ⬆️):

# fetch GRASS variables as shell environment variables:
eval `g.gisenv`
# use double quotes:
sqlitebrowser "$GISDBASE/$LOCATION_NAME/$MAPSET"/sqlite/sqlite.db
πŸ™ˆ bestie use double quotes in that sqlitebrowser line, and note that the eval \g.gisenv`` uses backticks β€” copy it exactly, don't freestyle it.

πŸ‘€ SEE ALSO πŸ‘€

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

πŸ’€ SOURCE CODE πŸ’€

available at: SQLite DATABASE DRIVER source code (history)

accessed: Tuesday Sep 08 11:54:02 2026

main index | topics index | keywords index | graphical index | full index

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


and that's the whole vibe bestie 🌈 this manual page came to you from GRASS 8.5.0, grass-sqlite(1grass) β€” go create some tables, you got this πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from