Skip to main content
On this page

Kater CLI Build an analysis source

kater source patch

Changes single properties at the top of a Kater file, in place, such as a query's label.

Every other line stays as written, comments included. Use it in place of a whole-file write when you change only a few keys.

Examples

Terminal window
# Go to the ad_reporting workspace in your local copy of Kater content
cd connections/snowflake_prod_connection/workspaces/ad_reporting
# Set the label of the spend_by_platform query
kater source patch query_contracts/spend_by_platform.sql --edits '[{"at": "label", "value": "Spend by platform"}]'
# Make the workspace's first parameter, reporting_date, default to 6 months
kater source patch workspace.sql --edits '[{"at": "parameters[0].default_value", "value": 6}]'
# Take out the workspace's description
kater source patch workspace.sql --edits '[{"at": "description", "value": null}]'
# Give the paid_media_performance app the spring theme
kater source patch apps/paid_media_performance/kater.app.yaml --edits '[{"at": "application.theme", "value": "spring"}]'
# Read the edits from edits.json in place of the command line
kater source patch query_contracts/spend_by_platform.sql --edits-file edits.json

Arguments

ArgumentDescription
<file>The Kater file to change: a .sql file’s frontmatter, an app’s kater.app.yaml, a dashboard, a theme, ai_tools/config.yaml or connection.yaml.

Options

OptionDescription
--edits <json>The changes, as a JSON list. Each item names a property with at and gives its new value, such as [{"at": "label", "value": "Spend by platform"}]. A null value takes the property out. In a .sql file, a path is inside the model’s frontmatter, such as label or parameters[0].default_value.
--edits-file <file>The same JSON list, in a file. - reads it from standard input.
--model <name>In a .sql file that holds several models, the model whose frontmatter changes, by its name.
--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.

How it changes the file

  • In order. Kater makes the edits in the order of the list.
  • What Kater writes is refused. Kater refuses a property that it writes itself, such as a model’s name or an app’s id, and says why.
  • How it saves. It saves as kater source write does, with the same checks. connection.yaml saves as kater admin connection update does.
  • Its old name is kater source frontmatter.

See also