The sq SQLite driver implements connectivity for the SQLite database. It makes use of the backing mattn/sqlite3 library. The driver implements all optional sq driver features.

Add source

Use sq add to add a source. The location argument is simply the filepath to the SQLite DB file. For example:

# Relative path
$ sq add ./sakila.db

# Absolute path
$ sq add /Users/neilotoole/sakila.db

sq usually can detect that a file is a SQLite datafile, but in the event it doesn’t, you can explicitly specify the driver type:

$ sq add --driver=sqlite3 ./sakila.db

Use the connection string form with prefix sqlite3:// to specify connection parameters.

$ sq add 'sqlite3://sakila.db?cache=shared&mode=rw'

The full set of supported parameters can be found in the mattn/sqlite3 docs.

Create new SQLite DB

You can use sq to create a new, empty, SQLite DB file.

$ sq add --driver sqlite3 hello.db
@hello  sqlite3  hello.db


The SQLite driver has several extensions baked in.

vtableVirtual Table
👉 sq inspect will show the virtual table’s type as virtual.
fts5Full Text Search 5
math_functionsMath Functions
introspectAdditional PRAGMA statements: function_list, module_list, pragma_list
stat4Additional statistics to assist query planning