On this page
Kater CLI Build an analysis query
kater query
Lists and changes the queries in a workspace.
kater new query adds a query, and kater show shows its rows. A query is a SQL file in the workspace’s query_contracts/ folder, and its charts show its rows.
Commands
| Command | What it does |
|---|---|
kater query fields | List the fields a new query can pick, with what each offers. |
kater query list | List a workspace’s queries in their tab order. |
kater query reorder | Change the order of a workspace’s queries. |
kater query label | Set the label of a field a query returns. |
kater query new | Make a query from the fields you pick. |
kater query card | Turn a query into a card to take its chart elsewhere. |
kater query sandbox | Open a workspace query in a new scratch file in your Sandbox. |
kater query compare | Find where two queries or workspaces differ. |
Commands that take a JSON request
kater query list, reorder, label, new, card, sandbox and compare each take one JSON request with --request-file. - reads the request from standard input. Each command’s page lists the keys of its request.
Each of these commands runs the Kater operation of the same name. An operation’s dotted name gives its command, so query.new is kater query new, and dashboard.tiles.add is kater dashboard tiles add.
A request names a workspace by its path from the content root, such as {"path": "connections/snowflake_prod_connection/workspaces/ad_reporting"}.
Examples
# Go to the ad_reporting workspace in your local copy of Kater contentcd connections/snowflake_prod_connection/workspaces/ad_reporting# Copy the spend_by_platform query as spend_by_platform_reviewkater new query --target-path . --name spend_by_platform_review --duplicate-from spend_by_platform# List the fields that a new query in the workspace can showkater query fields .# Run the SQL body of the spend_by_platform query and show its first rowskater show --select query_contracts/spend_by_platform.sql --selection 5:0-12:30# Write the query in new-query.json from the fields it selectskater query new --request-file new-query.json