Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SQLite

A SQLite profile is one database file, opened in datarig’s own process: there is no server, no network and no password. The profile has driver = "sqlite" and the absolute path of an existing file (Configuration); datarig never creates the file, and refuses a relative path or a file: name before it opens anything. SQLite 3.54 is built into datarig, so every machine opens files with the same library, whatever SQLite the system has. CI runs the driver’s tests on real files on Linux, macOS and Windows.

Read-only profiles. A read-only profile opens the file read-only and turns PRAGMA query_only on, and datarig checks both before the session connects; a statement that writes is refused before it is sent. A file in WAL mode in a folder datarig cannot write to may not open read-only at all (SQLite needs its -shm file there): the connection then fails with SQLite’s own words.

Locks. Another program may use the file at the same time. A result is read page by page with the file released between pages, so a writer elsewhere does not wait for you while you read; an export reads in chunks the same way. A statement that waits for another program’s lock waits no longer than the profile’s lock wait (none by default), then fails as a lock timeout.

One file, one schema. The explorer shows the file’s main schema. SQLite’s own tables (sqlite_schema, sqlite_sequence, sqlite_stat1, …) are left out of the tree; a statement can still read them. ATTACH, DETACH, VACUUM INTO and loading extensions are always refused: a profile reaches its own file and nothing else. foreign_keys is on for every session, whatever the library’s default.

What datarig does on SQLite

WhatOn SQLiteNotes
ConnectYesAn existing file by its absolute path; never created.
Read tables and run statementsYesStatements are split and judged by SQLite’s own rules, triggers’ bodies kept whole.
Filter a tableYesLIKE matches case only for ASCII letters, so a case-insensitive match of other letters is refused (Filtering).
ExportYesCSV, JSON and SQL; a table with a primary key in chunks (Export).
Copy as SQLPartlyA value SQLite shows the same as a value of another kind (0x… of bytes and of text) is refused.
Edit and applyYesOne transaction per apply, holding the file for writing from its start; never by the rowid (Editing data).
Manual commitNoNot built for SQLite: a write held open by hand would keep the file locked for every other program. A BEGIN you type is followed.
Show and open DDLYesThe CREATE text as the file keeps it.
Query plansYesEXPLAIN QUERY PLAN, steps only: SQLite gives no cost and no time, and measures nothing, so never with ANALYZE (Plans).
Row estimatesNoSQLite’s plans have no row estimates; the exact count works.
Startup SQLPartlyOnly PRAGMA cache_size, foreign_keys, recursive_triggers and temp_store (Startup SQL).
Cancel a running statementYesThe library is interrupted in datarig’s process.
Server monitorNoThere is no server: no other session to watch.

Not supported

  • Other files of a profile (ATTACH): refused, see above.
  • Encrypted files (SQLCipher) and tables of a module not built in: they cannot be read.
  • Files on a network share: SQLite’s locks are not reliable there, and datarig does not warn.