Kater CLI Make and compare
kater diff
Says whether two answers are the same and shows where they differ.
Use it to check that a changed query, or a copy of a workspace, still returns the same rows. Each pair runs on the warehouse as one statement that returns only the rows that differ.
Examples
# Go to a connection in your local copy of Kater contentcd connections/snowflake_prod_connection# Check that two queries return the same spend by platform and currencykater diff --left workspaces/ad_reporting/spend_by_platform --right workspaces/ad_reporting/spend_conversion_value_by_platform# Diff every query of the workspace with your brainstorm copy of itkater diff --left workspaces/ad_reporting --right users/you@example.com/brainstorm/promote_roas/workspaces/ad_reporting# Diff one query with your copy of it, over the last 6 complete monthskater diff --left workspaces/ad_reporting/paid_media_spend_trend --right users/you@example.com/brainstorm/promote_roas/workspaces/ad_reporting/paid_media_spend_trend --parameter is_within_last__union__date_day=6# Diff the first two statements of a scratch filekater diff --left users/you@example.com/brainstorm/promote_roas/spend_check.sql#0 --right users/you@example.com/brainstorm/promote_roas/spend_check.sql#1Options
It also takes the global options anywhere on the line, and --help.
What each pair says
Each pair has a status, which --json gives, and a result in words, which the command prints first on the pair’s line, such as 3 of 10 rows differ, Same in all 39 rows or Does not compile. A result check of a query with more than 10,000 rows compares a sample of them, and its words count the compared rows, such as 5 of 10,000 compared rows differ.
| Status | What it means |
|---|---|
same | Every row and column of the pair matches. |
different | Some rows differ. It gives the first 50 differences. A difference is a value that differs, or a row that only one side has. It can also be a key that more than one row on one side has, counted for each side. |
only_left, only_right | Across two workspaces, a query that only one of them has. |
refused | A side could not run, and the result and the message say why. For example, it does not compile, or you cannot read it. A pair that the warehouse could not run reads Could not check. The other pairs still run. |
The command prints each pair’s result and message, and its first 10 differences. The last line counts the pairs by result, such as 3 pairs: 1 same, 1 different, 1 could not check. --json gives every difference, and the first 10 rows that both sides have alike. A difference does not fail the command. It exits with 1 only when no pair differs and at least one pair is refused.
How it diffs
- Defaults apply. Each side runs with each filter as its call says (a required filter on, an optional filter on only with
on=TRUE) and each parameter at its default, except the parameters that--parametersets. - Columns pair by name, after
--columngives a left column its right name. A column that only one side returns is listed, and not diffed. - Numbers are diffed at the decimal places that their format shows. A number with no format must match to one part in a billion.
- Paths that start with
connections/are from the content root. Other paths are relative to the folder you are in, or to--kater-rootwhen you give it.
What it can diff
- Queries diff from connection workspaces and from your own workspaces. A query in another person’s private workspace is refused.
- Scratch statements run as
kater showruns them. - One connection. Both sides must read the same connection. A side that diff does not run, such as custom SQL, is refused.
- A copy and its original. Across a brainstorm copy and the workspace that it copies,
changedmarks each query that the copy changed. See Workspace copies.
Through the MCP
Through the Kater MCP, the result’s app_url opens it in Kater. A copy and its original open on the copy’s diff view, at the query that the chat’s card opens on. Any other diff opens at the left side’s place.