Kater CLI Topics
Selecting models and tests
How --select, --exclude and --state select the models and tests a command works on, with dbt's selection grammar.
A selection says which models and tests a command works on. Kater reads it as dbt does. You give it with --select, or -s, and you take nodes out of it with --exclude. Each model and each test is one node of the project’s graph, the graph that kater parse writes to target/manifest.json.
# Go to a workspace in your local copy of Kater contentcd connections/snowflake_prod_connection/workspaces/ad_reporting# Run one saved querykater run --select query_contracts/spend_by_platform.sql# Compile the queries that have the tag team=financekater compile --select "tag:team=finance,resource_type:query"# Run the tests of the shared ad_reporting modelkater test --select semantic.ad_reporting# List the query and everything that it readskater ls --select +query_contracts/spend_by_platform.sqlWhich commands take it
kater build, kater compile, kater run, kater parse, kater ls, kater test, kater test snapshot, kater sync, kater model list, kater model describe and kater model search take --select, --exclude and --state. kater show takes --select for the one model that it shows.
Without --select, each command works on these:
kater compileandkater runwork on your scope, or else on the workspace or modeling folder you are in.kater testandkater test snapshotwork on every test of the connection you are in, or of your only connection.kater build,kater parseandkater lsread the whole project.kater syncworks on every table that the connection’sconnection.yamlselects.kater model list,describeandsearchwork on your scope.
Use kater ls to see what a selection selects before you run it. It sends nothing to the warehouse.
A bare word
A word with no method is one of these:
- A path. A word that has a
/or ends in.sqlis a file or a folder, such asquery_contracts/spend_by_platform.sqlorworkspaces/ad_reporting..and..are paths too. A path is relative to the folder you run the command in. A path that starts withconnections/is from the content root. A folder selects every model in it and in the folders under it. - A typed address. The model’s kind and its name, such as
semantic.ad_reportingorquery.spend_by_platform. - A name. The name of a model or a test, such as
spend_by_platform.*matches any text and?matches one character, as in a shell:spend_*.
A folder name with no /, such as query_contracts, is a name. Write path:query_contracts or query_contracts/ to select the folder.
Methods
A method is a word, a colon and a value.
| Method | Selects | Example |
|---|---|---|
path: | The models and tests in a file or a folder. | path:workspaces/ad_reporting |
tag: | The models and tests that have a tag. key=value matches that value and the values under it, so team=marketing matches team=marketing/lifecycle. A key alone matches any value. | tag:team=finance, tag:certified |
resource_type: | The nodes of one kind: query, chart, semantic, kater_dataset, db_dataset, workspace or test. | resource_type:query |
connection: | The models and tests of one connection, by its folder name. | connection:snowflake_prod_connection |
workspace: | The models and tests of one workspace, by its name. | workspace:ad_reporting |
app: | The queries that an app’s pages read. | app:monday_brief |
source: | A DB dataset, by its name. | source:google_ads__keyword_report |
state: | state:modified selects what changed since the state that --state names. state:new selects only what that state does not hold. | state:modified |
result: | The nodes with this status in target/run_results.json: error, fail, warn, skipped, success or pass. | result:fail |
See Structured model tags for how tags work.
Graph operators
A graph operator adds the nodes around a node.
| Operator | Adds | Example |
|---|---|---|
+x | What x reads, at any depth. | +query.spend_by_platform |
2+x | What x reads, two steps up. | 2+query.spend_by_platform |
x+ | What reads x, at any depth. | semantic.ad_reporting+ |
x+1 | What reads x, one step down. | semantic.ad_reporting+1 |
@x | What reads x, and everything those nodes read. | @semantic.ad_reporting |
An operator works on a bare word and on a method, such as +tag:team=finance or state:modified+.
Union and intersection
- A space is a union.
--select "query.spend_by_platform query.paid_media_spend_trend"selects both queries. - A comma is an intersection.
--select "tag:team=finance,resource_type:query"selects only the queries that have the tag. - Repeat
--selectfor more.--select a.sql --select b.sqlis the same as--select "a.sql b.sql".
Put a selection with a space in quotes, so the shell gives it as one value.
A term that matches nothing
A term that selects no model or test prints a warning, as dbt’s does, and the command goes on with the other terms. When a name or a path is close to one in the project, the warning gives it:
15:20:03 Warning: --select spend_by_platfrom matches no object. Did you mean spend_by_platform?A command whose whole selection selects nothing says “Nothing to do.” and exits 0. state: and result: give no warning, because a branch that changed nothing and a run with no failure are not mistakes. With --warn-error, a warning makes the command exit 1, so a CI step stops on a mistyped selection.
Exclude
--exclude takes the same words as --select. Kater selects first, then takes out each node that --exclude selects.
# Run every saved query in the workspace, and leave out the chartskater run --select . --exclude resource_type:chartState
state:modified and state:new compare the project with an earlier state. --state names that state:
--state git:REFcompares with the files where this branch left REF, such asgit:main. It counts the files committed since then, the files changed but not committed, and new files.--state FOLDERcompares with themanifest.jsonin that folder, from an earlierkater parse. Make that manifest with a parse of the whole project. A node that the manifest does not hold counts as new.
# Run the tests of what this branch changed since it left main, and of what reads itkater test --select state:modified+ --state git:main# Run the merge check: only those tests whose compiled SQL moved since their last passkater test --select state:modified+ --state git:main --staleTests
A test run selects tests as dbt does:
- A model selects its tests.
--select semantic.ad_reportingruns the shared layer’s tests of that model, and each person’s that you can read. - A test file selects its tests. Give its path, or
path:and its path. - A test name selects that test.
--select path:connections/snowflake_prod_connection/modeling/kater_objects/tests/ad_reporting.sql,july_2026_totals_by_platformselects one test of one file. - One connection for each run. A run stops when a selection reaches the tests of more than one connection. Add
connection:NAMEto the selection, such as--select connection:snowflake_prod_connection,tag:team=marketing.
Other collection flags
Other flags that take more than one value take one value for each flag, such as --sources, --key and --add-fields: --key platform --key currency.