Skip to main content
On this page

Kater CLI Build an analysis source

kater source rebase

Changes a query's or a chart's SQL to read its own workspace.

Use it after you paste SQL that reads the workspace’s shared model, such as a Catalog example. It also works for SQL that you copied from another workspace. Kater saves the file as kater source write does.

Examples

Terminal window
# Go to the snowflake_prod_connection connection in your local copy of Kater content
cd connections/snowflake_prod_connection
# Make a query that reads semantic.ad_reporting read the ad_reporting workspace instead
kater source rebase workspaces/ad_reporting/query_contracts/clicks_by_platform.sql --move read_through
# Make SQL copied from the ad_reporting workspace read the ad_reporting_review workspace
kater source rebase users/you@example.com/workspaces/ad_reporting_review/query_contracts/spend_by_platform.sql --move move_namespace --from-workspace workspaces/ad_reporting

Arguments

ArgumentDescription
<file>The query or chart .sql file, in a workspace. Every query or chart in the file changes.

Options

OptionDescription
--move <move>Required. What to change. read_through makes SQL that reads the workspace’s shared model read the workspace instead. move_namespace makes SQL copied from the workspace in --from-workspace name this file’s workspace instead.
--from-workspace <path>With move_namespace: the workspace that the SQL was copied from, by its folder’s path from the folder you are in.
--expected-revision <sha>The SHA-256 of the file as you read it. Kater refuses the change when the file changed since.

It also takes the global options --json, --kater-root, --scope and --help.

What it changes

  • read_through is for SQL that reads the shared model the workspace selected, such as FROM semantic.ad_reporting from a pasted Catalog example. It then reads the workspace.
  • move_namespace is for SQL that you copied from another workspace. Its names then point at this file’s workspace.
  • A workspace’s own workspace.sql is refused. To change the model a workspace reads, use kater workspace source use.
  • It saves as kater source write does, with the same checks and --expected-revision.

See also