Summary
Run SQL against the sandbox without leaving the CLI. dbts sql -q "SELECT ..." for one-shot queries (Rich-rendered table); bare dbts sql opens a REPL.
Why
The most common manual context-switch in the dev loop today: after every dbts build, you SELECT * to sanity-check the result — currently means switching to Snowsight or maintaining a separate snowsql config. dbts sql already has the right target, role, and warehouse.
Sketch
dbts sql -q "..." — execute, render rows as a Rich table, exit.
dbts sql -f file.sql — read query from file.
dbts sql — REPL (multiline, history, semicolon-terminated). Either shell out to snowsql if installed, or use prompt_toolkit for a small interactive loop.
--target flag like the dbt pass-throughs (default sandbox).
--limit N (default 100) so accidental SELECT * from a billion-row table doesn't hang the terminal.
Where it'd live
- New module
src/dbts/sql_cmd.py (avoid shadowing stdlib sql).
- Reuse
snowflake.connect / run_sql.
- Output uses
rich.table.Table (same as clone.status).
Effort
Small for the one-shot path, medium for the REPL.
Tier
Tier 1 — recommended (highest-frequency missing dev action).
Summary
Run SQL against the sandbox without leaving the CLI.
dbts sql -q "SELECT ..."for one-shot queries (Rich-rendered table); baredbts sqlopens a REPL.Why
The most common manual context-switch in the dev loop today: after every
dbts build, youSELECT *to sanity-check the result — currently means switching to Snowsight or maintaining a separatesnowsqlconfig.dbts sqlalready has the right target, role, and warehouse.Sketch
dbts sql -q "..."— execute, render rows as a Rich table, exit.dbts sql -f file.sql— read query from file.dbts sql— REPL (multiline, history, semicolon-terminated). Either shell out tosnowsqlif installed, or useprompt_toolkitfor a small interactive loop.--targetflag like the dbt pass-throughs (default sandbox).--limit N(default 100) so accidentalSELECT *from a billion-row table doesn't hang the terminal.Where it'd live
src/dbts/sql_cmd.py(avoid shadowing stdlibsql).snowflake.connect/run_sql.rich.table.Table(same asclone.status).Effort
Small for the one-shot path, medium for the REPL.
Tier
Tier 1 — recommended (highest-frequency missing dev action).