On this page
Kater CLI Build an analysis query
kater query compare
Compares two queries, or every query of two workspaces, and says where their rows differ.
Use it to check that a changed query still gives the same numbers. It runs the same comparison as kater compare, from a JSON request.
Examples
# Check that two queries give the same spend for each platform, with the request in compare.jsonkater query compare --request-file compare.json# Compare every query of ad_reporting with the same query in your brainstorm copyecho '{"left": {"workspace": "connections/snowflake_prod_connection/workspaces/ad_reporting"}, "right": {"workspace": "connections/snowflake_prod_connection/users/you@example.com/brainstorm/promote_roas/workspaces/ad_reporting"}}' | kater query compare --request-file -Arguments
Options
It also takes the global options --json, --kater-root, --scope and --help.
The request
This request compares spend_by_platform with spend_conversion_value_by_platform, row by row for each platform and currency:
{"left": {"workspace": "connections/snowflake_prod_connection/workspaces/ad_reporting", "query": "spend_by_platform"}, "right": {"workspace": "connections/snowflake_prod_connection/workspaces/ad_reporting", "query": "spend_conversion_value_by_platform"}, "key": ["platform", "union__currency"]}| Key | What it holds |
|---|---|
left, right | The two sides. A side is a saved query, {"workspace": ..., "query": ...}, or a scratch statement, {"path": ..., "statement": ...}, counted from 0. A {"workspace": ...} alone on both sides pairs the queries of two workspaces by name. Paths are from the content root. |
key | The columns that pair a row of one side with a row of the other, by the left side’s names. Without it, Kater uses the row dimensions that both sides return. With none, it compares the sides as sets of rows. |
columns | Left columns to compare with a right column of another name, as an object. Each key is a left name, and its value is the right name. |
parameters | Parameter values by name, for each side that declares the parameter. Otherwise each side runs at its defaults, with its own filters on. |
precision | The decimal places to compare numbers at, from 0 to 12, when that is finer than their format. Without it, numbers compare at their format’s places. |
How it runs
Each side runs where you can already run it: a saved query as kater run runs it, and a scratch statement as the Sandbox runs it. Each pair runs as one warehouse statement that returns only the rows that differ, one pair at a time.