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
| What | On SQLite | Notes |
|---|---|---|
| Connect | Yes | An existing file by its absolute path; never created. |
| Read tables and run statements | Yes | Statements are split and judged by SQLite’s own rules, triggers’ bodies kept whole. |
| Filter a table | Yes | LIKE matches case only for ASCII letters, so a case-insensitive match of other letters is refused (Filtering). |
| Export | Yes | CSV, JSON and SQL; a table with a primary key in chunks (Export). |
| Copy as SQL | Partly | A value SQLite shows the same as a value of another kind (0x… of bytes and of text) is refused. |
| Edit and apply | Yes | One transaction per apply, holding the file for writing from its start; never by the rowid (Editing data). |
| Manual commit | No | Not 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 DDL | Yes | The CREATE text as the file keeps it. |
| Query plans | Yes | EXPLAIN QUERY PLAN, steps only: SQLite gives no cost and no time, and measures nothing, so never with ANALYZE (Plans). |
| Row estimates | No | SQLite’s plans have no row estimates; the exact count works. |
| Startup SQL | Partly | Only PRAGMA cache_size, foreign_keys, recursive_triggers and temp_store (Startup SQL). |
| Cancel a running statement | Yes | The library is interrupted in datarig’s process. |
| Server monitor | No | There 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.