Kater CLI Make and compare new
kater new query
Makes a query in a workspace: a blank query, a query from your own SQL, or a copy of another query.
The new query goes in the workspace’s query_contracts/ folder. To build a query from the fields you select, use kater query new.
Examples
# Go to the ad_reporting workspace in your local copy of Kater contentcd connections/snowflake_prod_connection/workspaces/ad_reporting# Add a blank query named clicks_by_platformkater new query --name clicks_by_platform# Add a query from its SQL alone, and let Kater write the top of the fileecho "SELECT ad_reporting.platform, ad_reporting.sum__impressions FROM workspace.ad_reporting AS ad_reporting GROUP BY ad_reporting.platform" | kater new query --name impressions_by_platform --sql-file -# See the file that a copy of spend_by_platform writes, and save nothingkater new query --name spend_by_platform_review --duplicate-from spend_by_platform --dry-run# Copy the spend_by_platform query as spend_by_platform_reviewkater new query --name spend_by_platform_review --duplicate-from spend_by_platformArguments
Options
It also takes the global options --json, --kater-root, --scope and --help.
What it writes
- A blank query, with no SQL, file or copy, reads its workspace and selects nothing.
--sql-filegives the SQL alone, and Kater writes the top of the file.--query-filegives the whole file, which Kater checks before it saves.- It reads through the workspace. Kater changes SQL that reads the workspace’s shared model to read the workspace. For example, it changes
FROM semantic.ad_reportingin SQL from a Definitions example. --namewins over the name in a--query-file. A name that is taken is refused, never numbered.
Check that nothing changed since a dry run
A --dry-run answer lists witnesses: the revisions of what the create reads. Give each one back to the create with its option, such as --namespace-revision. When one changed since the dry run, the create stops and asks you to make a new dry run. An option for a revision that a query create never reads stops the create for any value.