Kater CLI Build and check
kater show
Runs one model, a statement of a scratch file, or SQL on your warehouse, and shows its first rows, as dbt show does.
Use it to see what a model returns, or to try SQL before you save it as a query. It saves nothing. With --dry-run, it shows the SQL and runs nothing.
Examples
# Go to the ad_reporting workspace in your local copy of Kater contentcd connections/snowflake_prod_connection/workspaces/ad_reporting# Show 5 rows of the spend_by_platform querykater show --select query.spend_by_platform# Show 10 values of the platform field of the workspace's rootkater show --select workspace.ad_reporting --field platform --limit 10# Show the warehouse SQL that the spend_by_platform query compiles to, and run nothingkater show --select query_contracts/spend_by_platform.sql --dry-run# Show the warehouse SQL of the workspace's rootkater show --select workspace.sql --dry-run# Compile the unsaved text in draft.sql as the spend_by_platform querykater show --select query_contracts/spend_by_platform.sql --text-file draft.sql --dry-run# Run the SQL body of the spend_by_platform query, lines 6 to 13, and show up to 20 rowskater show --select query_contracts/spend_by_platform.sql --selection 5:0-12:30 --limit 20# Run SQL on the workspace and show the first 5 rowskater show --inline "SELECT ad_reporting.platform, ad_reporting.sum__clicks FROM workspace.ad_reporting AS ad_reporting GROUP BY ad_reporting.platform"# Go to the snowflake_prod_connection connectioncd ../..# Run the first statement in your scratch file spend_checks.sqlkater show --select users/you@example.com/brainstorm/spend_checks.sql --statement 0# Run every statement in the scratch file, in orderkater show --select users/you@example.com/brainstorm/spend_checks.sql --all# Compile the statement at line 4, character 11, and show it without running itkater show --select users/you@example.com/brainstorm/spend_checks.sql --at 3:10 --dry-runOptions
It also takes the global options --json, --kater-root, --scope and --help.
What to give it
Give --select, --inline or --inline-file, and only one of them. --select names one thing. Name a model one time, and add its file as path:FILE only when you need it, such as --select path:query_contracts/spend_by_platform.sql,query.spend_by_platform.
- A model, by its name or typed address, shows its rows. Add
--fieldto see the values of one field. - A model’s file shows the model that the file declares.
- A scratch file needs
--statement,--ator--all. - Any SQL file takes
--selectionto run one part of it.
Kater finds a model that you name in the whole project, so you need no --scope. When a query and its chart have the same name, it shows the query. When two models of other kinds have the name, such as a DB dataset and the Kater dataset over it, the command stops and lists them: name one as TYPE.NAME, such as kater_dataset.facebook_ads__ad_report.
SQL from --inline or --inline-file runs in your scope. Name the workspace with --scope, or else Kater uses the scope that kater scope use saved, or the folder you are in.
What it prints
It prints Previewing node 'NAME':, then the rows as a table, one line for each row. Each column has the name the warehouse gives it, as in dbt show, such as | PLATFORM | SUM__CLICKS | on Snowflake. SQL from --inline prints Previewing inline node:. When the model has more rows than --limit, the last line says so. A scratch file with --all prints one block for each statement. With --dry-run, it prints only the SQL.
Statements in a scratch file
A scratch file holds statements in your brainstorm folder. What a statement reads decides where it runs: one shared model, several shared models joined, or warehouse tables. A statement that reads warehouse tables needs edit access to the shared models.
Lines and characters count from 0, so line 4 in an editor is line 3.