Skip to main content
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

CommandWhat it does
kater query fieldsList the fields a new query can pick, with what each offers.
kater query listList a workspace’s queries in their tab order.
kater query reorderChange the order of a workspace’s queries.
kater query labelSet the label of a field a query returns.
kater query newMake a query from the fields you pick.
kater query cardTurn a query into a card to take its chart elsewhere.
kater query sandboxOpen a workspace query in a new scratch file in your Sandbox.
kater query compareFind 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

Terminal window
# Go to the ad_reporting workspace in your local copy of Kater content
cd connections/snowflake_prod_connection/workspaces/ad_reporting
# Copy the spend_by_platform query as spend_by_platform_review
kater 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 show
kater query fields .
# Run the SQL body of the spend_by_platform query and show its first rows
kater show --select query_contracts/spend_by_platform.sql --selection 5:0-12:30
# Write the query in new-query.json from the fields it selects
kater query new --request-file new-query.json

See also