CLI Reference
sqb query
Run ad hoc SQL queries against the project database.
Execute ad hoc SQL against the active project connection. Useful for inspecting data, debugging models, or running one-off queries without leaving the SQLBuild CLI.
sqb --project-dir <path> query "SELECT * FROM dev.fact_orders LIMIT 5"Or from a file:
sqb --project-dir <path> query --file my_query.sqlFile paths are resolved from the current working directory.
| Flag | Description |
|---|---|
sql |
SQL to execute (positional argument) |
--file |
Read SQL from a file instead of the command line |
--format |
Output format: long (default), table, json, or csv |
--limit |
Maximum rows to return (default: 20) |
--no-limit |
Disable the row limit |
Output formats
Section titled “Output formats”long (default)
Section titled “long (default)”Vertical record format, one field per line:
-[ RECORD 1 ]---------------------------+order_id | 1customer_id | 100status | completed
-[ RECORD 2 ]---------------------------+order_id | 2customer_id | 200status | completed
2 rowsHorizontal table format:
order_id | customer_id | status-------- | ----------- | ---------1 | 100 | completed2 | 200 | completed
2 rowsJSON array of objects:
[{"order_id": 1, "customer_id": 100, "status": "completed"}]Standard CSV with headers:
order_id,customer_id,status1,100,completed2,200,completedExamples
Section titled “Examples”# Quick inspection with default formatsqb query "SELECT * FROM dev.fact_orders"
# Table format with higher limitsqb query "SELECT * FROM dev.dim_customers" --format table --limit 50
# Export to JSONsqb query "SELECT * FROM dev.daily_revenue" --format json --no-limit
# Run SQL from a filesqb query --file debug_query.sql