Directives
Query-file directives are SQL line comments with machine-readable fields.
tonic-file
Section titled “tonic-file”-- tonic-file: target=warehouse context.schema=analytics autocommit=offAllowed fields:
targetcontext.<key>autocommit
Rules:
- Must appear before the first SQL statement.
- Only one
tonic-filedirective is allowed. - May declare target, context, autocommit, or any combination.
tonic-bind
Section titled “tonic-bind”-- tonic-bind: handle=writer target=warehouse context.schema=public autocommit=offAllowed fields:
handletargetcontext.<key>autocommit
Rules:
- Must appear before the first SQL statement.
handleandtargetare required.- Each handle may only be declared once.
-- tonic: handle=writerupdate jobs set last_run_at = current_timestamp where name = 'daily_sales';Allowed fields:
targethandlecontext.<key>
Rules:
- Applies to the next SQL statement only.
handlecannot be combined withtarget.autocommitis not allowed.- Blank lines are allowed before the statement, but unrelated comments break the association.
Context Merge Order
Section titled “Context Merge Order”Context resolves from broadest to most specific:
- CLI
--context key=valuedefaults. tonic-filecontext.tonic-bindcontext.- Per-statement
toniccontext.
If a handle fixed a specific context key, a statement cannot override that key to a different value.