SQLite
Persists walkerOS events to SQLite. One destination, two drivers behind a single interface: better-sqlite3 for local files (and :memory:), and @libsql/client for remote Turso / libSQL / sqld over HTTP or WebSocket. Driver selection is URL-driven; both SDKs are optional peer dependencies so you install only the one you need.
SQLite is a server destination in the walkerOS flow:
Receives events server-side from the collector, serializes them into a canonical row, and inserts them into a SQLite-compatible database. Good fit for single-host deployments (local file), embedded analytics (in-memory), and edge-deployed Turso databases.
Installation
- Integrated
- Bundled
Configuration
This destination uses the standard destination config wrapper (consent, data, env, id, ...). For the shared fields see destination configuration. Package-specific fields live under config.settings and are listed below.
Settings
| Property | Type | Description | More |
|---|---|---|---|
sqlite | object | SQLite / libSQL configuration |
Mapping
Per-event rules under config.mapping. For the standard rule fields (consent, condition, data, batch, name, policy) see mapping.
| Property | Type | Description | More |
|---|---|---|---|
table | string | Override target table name for this rule. Takes precedence over settings.sqlite.table. |
Examples
custom table
default insert
ignored event
order complete
table override
The destination opens the connection during init(), runs CREATE TABLE IF NOT EXISTS with the canonical schema (unless schema: 'manual'), and prepares the INSERT statement once. On destroy() the connection is closed cleanly. User-provided clients (wired via env.client or settings.sqlite._client) are left untouched.
Auto schema
With the default schema: 'auto', the first init() creates an events table mirroring the canonical walkerOS event shape:
CREATE TABLE IF NOT EXISTS events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
timestamp INTEGER,
event_id TEXT,
name TEXT,
entity TEXT,
action TEXT,
session_id TEXT,
user_id TEXT,
page_url TEXT,
page_title TEXT,
referrer_url TEXT,
data TEXT,
globals TEXT,
consent TEXT
)
Nested objects (data, globals, consent) are stored as JSON strings. page_url maps from source.id; page_title from data.title; referrer_url from source.previous_id.
Use mapping.settings.table to route specific events to a dedicated table (for example orders to orders, identities to identities).
Drivers
Local, better-sqlite3
Sync native driver, fastest option for single-host deployments. The URL is treated as a filesystem path; :memory: works too.
Remote, @libsql/client
Async HTTP/WSS driver for Turso, self-hosted sqld, or any libSQL-compatible endpoint. Auth via authToken.
URL prefixes libsql://, http://, https://, ws://, wss:// route to the libSQL driver. Anything else (bare paths, :memory:) routes to better-sqlite3.
Manual schema
Set schema: 'manual' to skip the auto CREATE TABLE. The user brings their own table and mapping. Useful when migrating from an existing schema (for example an older PHP-era events table) and you want the destination to insert into the same columns.
Limitations
- v1 issues one
INSERTper event. ApushBatchpath is planned for v2. - Connection death is not auto-retried; a fatal driver error logs and drops events until the flow restarts.
schema: 'manual'skipsCREATE TABLEbut still uses the canonical column layout for the prepared INSERT. If your custom table has a different shape, also provide a mapping that produces matching args.