Skip to content

Quick Start

This quick start uses SQLite because it does not need secrets or server setup.

Terminal window
tonic connections add sqlite scratch --path ./scratch.db --local

--local writes to <repo-root>/.tonic/config.yaml when you are inside a git repository. Outside a git repository, it writes to ./.tonic/config.yaml.

Terminal window
tonic query ping --target scratch

Expected shape:

ok target="scratch" backend=sqlite
Terminal window
tonic query exec --target scratch --sql 'select sqlite_version() as version'

Inline SQL is intentionally single-statement. Use query files for multi-statement workflows.

Terminal window
tonic query exec \
--target scratch \
--format json \
--sql "values (1, 'alpha'), (2, 'bravo')"

table, csv, and json are supported for query execution.

Create scratch.sql:

-- tonic-file: target=scratch
select 1 as id, 'from-file' as source;
select 2 as id, 'same-primary-session' as source;

Run it:

Terminal window
tonic query exec --file scratch.sql

File execution prints a statement header before each result in table and CSV modes so you can see the resolved target, session mode, and autocommit setting.

Terminal window
tonic inspect tables --target scratch --refresh

--refresh bypasses the persistent inspect cache and fetches live metadata.