Skip to main content
On this page

Kater CLI Build an analysis field

kater field edit

Changes a field of a saved query that an operation made, as the Edit form in Kater does.

It shows the field before and after the change, with its Kater SQL and its rows. A field written in its own SQL changes with kater source write instead.

Examples

Terminal window
# Go to the ad_reporting workspace in your local copy of Kater content
cd connections/snowflake_prod_connection/workspaces/ad_reporting
# See how the rank of conversions is made now, and what it can turn into
kater field edit --path query_contracts/which_platform_lead_on_conversions.sql --field rank__sum__conversions --list
# Rank the platforms from the fewest conversions, and save the change
kater field edit --path query_contracts/which_platform_lead_on_conversions.sql --field rank__sum__conversions --set order_direction=asc --write
# Change the field's label, step by step in a terminal
kater field edit --path query_contracts/conversions_last_month_vs_the_month_before.sql --field previous_month_percent_change__sum__conversions --label "Conversions change"

Options

OptionDescription
--path <file>Required. The query file that the field is on, by its path from the folder you are in.
--field <name>Required. The field to change, by its SQL name, such as rank__sum__conversions. Only a field made with an operation changes this way.
--model <name>The query in --path, by its name, when the file holds more than one.
--text-file <file>Query text to use in place of the saved file, such as an editor’s unsaved changes. - reads it from standard input.
--make <choice>Turns the field into something else, such as moving_average. Without it, the field stays what it is.
--set <name>=<value>One setting to change, such as order_direction=asc. The other settings stay as they are. You can give it more than one time.
--label <text>A new label for the field.
--name <name>A new SQL name, when --make turns the field into something else. The same choice keeps its name.
--description <text>A new description for the field.
--input <name>=<value>A parameter value for the preview. Give one for each parameter. You can give it more than one time.
--listShows how the field is made now, what it can turn into and its settings, in place of a change.
--no-inputNever asks, even in a terminal.
--limit <n>How many rows the preview shows, from 1 to 1,000. The default is 10.
--no-rowsDescribes the change, and does not run the query.
--writeSaves the change. Without it, a terminal asks first, and anywhere else nothing is saved.

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

How it works

In a terminal, it asks for each step, and starts from how the field is made now. It shows the field before and after, its Kater SQL and its rows. Anywhere else, or with --json or --no-input, it never asks. --write saves the change.

A field that is not made with an operation is refused. Change its SQL with kater source write.

See also