Sessions & Transactions
tonic is session-aware. Query files and serve --stdio can preserve transaction state across statements when execution uses a reusable session.
Autocommit
Section titled “Autocommit”Autocommit is execution intent, not saved connection config.
Valid values are on and off. The default is on.
tonic query exec --target warehouse --autocommit off --sql 'update jobs set touched = true where id = 1'For inline SQL, autocommit=off wraps the single non-transaction statement in a transaction and commits on success.
File Resolution
Section titled “File Resolution”Primary session autocommit resolves in this order:
tonic-file: autocommit=...- CLI
--autocommit - default
on
Handle session autocommit resolves in this order:
tonic-bind: ... autocommit=...tonic-file: autocommit=...- CLI
--autocommit - default
on
Ephemeral sessions always use autocommit=on.
Transaction Control
Section titled “Transaction Control”Transaction control is SQL-first:
begin;update accounts set plan = 'pro' where id = 1;commit;Supported transaction-control actions include begin, start transaction, commit, rollback, rollback to, savepoint, and release savepoint.
Inline query exec --sql rejects transaction-control statements. Use a query file or a service session for multi-statement transaction control.
Error Behavior
Section titled “Error Behavior”Statement errors do not automatically destroy reusable sessions. The runtime does not auto-commit or auto-rollback just because a statement failed.
When a reusable session closes with an open transaction, tonic attempts a best-effort rollback before closing the underlying connection.