GRASS logo

Note: A new GRASS GIS stable version has been released: GRASS GIS 7.6, available here.
Updated manual page: here

SQLite DATABASE DRIVER

Table of contents

The SQLite driver is the default DBMI backend.

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. It is sufficient to define the connection (see next step).

Connecting GRASS to SQLite

The database name 'sqlite.db' is at user's choice. Also the file storage location can be freely chosen. If the database does not exist, it will be 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

Supported SQL commands

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

Operators available in conditions

All SQL operators supported by SQLite.

Browsing table data in DB

A convenient SQLite front-end is sqlitebrowser. 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

SEE ALSO

db.connect, db.execute, db.select

SQL support in GRASS GIS

SQLite web site, SQLite manual, sqlite - Management Tools

Last changed: $Date: 2016-11-13 15:09:36 -0800 (Sun, 13 Nov 2016) $


Note: A new GRASS GIS stable version has been released: GRASS GIS 7.6, available here.
Updated manual page: here

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

© 2003-2019 GRASS Development Team, GRASS GIS 7.2.4svn Reference Manual