Kater CLI Find and understand model
kater model edit
Proposes a change to a model, such as a new field, filter or join, and writes the SQL for it.
Without --write, it shows the plan and changes nothing. Add --write to save the change.
Examples
# Go to the ad_reporting workspacecd connections/snowflake_prod_connection/workspaces/ad_reporting# Propose adding the Clicks measure to the spend_by_platform querykater model edit query.spend_by_platform --path query_contracts/spend_by_platform.sql --add-fields ad_reporting.sum__clicks# Add it, and save the filekater model edit query.spend_by_platform --path query_contracts/spend_by_platform.sql --add-fields ad_reporting.sum__clicks --write# Propose the quick operations in operations.json, and keep the proposal in proposal.jsonkater model edit query.spend_by_platform --path query_contracts/spend_by_platform.sql --operations-file operations.json --json > proposal.json# Save the proposal that you keptkater model edit query.spend_by_platform --path query_contracts/spend_by_platform.sql --apply-plan proposal.json --writeArguments
Options
It also takes the global options --json, --kater-root, --scope and --help.
What goes together
- One kind of change at a time. Give field changes,
--extract-stage,--fixor--apply-plan, and only one of them. - Field changes. These are
--add-fields,--remove-output,--create-projection,--duplicate-projection, the quick operations, the filter and parameter changes, the relationship changes and--clauses. - Relationship changes go on their own.
- Grouping and row limit come after fields.
--clausesdoes not go with added or removed fields. Add or remove the fields first, then change the grouping or the row limit. - New fields go apart from quick operations. Quick operations and
--clausesdo not go with--create-projectionor--duplicate-projection. - Give each JSON value one time. Give
--operationsor--operations-file, not both, and so on. Only one file option can read stdin. - A plan keeps its file.
--apply-planuses the file as it was when Kater made the plan. So it does not take--text-file.
Quick operations
A quick operation is a change from a field’s menu, such as a running total or a display format. Kater writes the SQL for it. kater operation list with --field and --operation gives the exact item to send. Use the field.describe operation to change a field’s description, AI context, tags and business questions. See Quick operations.
Filter and parameter changes
Each item’s kind is remove_filter, update_filter, update_parameter, reorder_filters or add_custom_filter. An item can also have name, label, description, ai_context, order, predicate and required. See Filters and parameters.
Relationship changes
Each item’s kind is add_relationship, update_relationship, remove_relationship or rename_alias. An item can also have these keys:
name,model,aliasandto.keys, a list of objects withfieldandother_field.required,cardinality, andjoin_type, which isleftorinner.label,descriptionandai_context.
update_relationship changes what a join carries, and its keys and its model too. remove_relationship also takes out the fields that read the joined model. rename_alias gives a source a new alias, and changes every column that reads it. See Relationships and joins.