On this page
Kater CLI Topics
Quick operations
Change a model's SQL through typed operations, and the options that document commands take.
Change a model’s SQL through these operations, and let the writer write it. kater source write is for what no operation expresses. Find the supported operations before you build an edit. Pass each returned target and operation_id with a parameters object that holds the values you selected.
| Families | What they do |
|---|---|
aggregations, derive, windows, comparisons, calculate_at | Add a field. |
filters, sort, filter_by_this_number | Change a clause. filter_by_this_number is a number measure’s HAVING condition in a query, or its Top N in QUALIFY. |
format, timeframes, field | Change a field, or name or copy it. field.classify writes a field’s classification, and field.not_additive_across a measure’s non-additive rule. |
# List the operations the AMOUNT field offerskater operation list FILE --field AMOUNT --json# Show what AMOUNT can be turned intokater new field --path FILE --from AMOUNT --list# Add the percent change from the previous period, without promptskater new field --path FILE --kind calculation --from AMOUNT --make previous_period --set output=percent_change --no-input# Turn a running sum into a 6-period moving average, and save itkater field edit --path FILE --field running_sum__amount --make moving_average --set size=6 --write# Find the "is equal to" operation for the STATUS fieldkater operation search 'is equal to' FILE --field STATUS --family derive --json# Propose the edits in operations.json and save the proposalkater model edit query.orders --path FILE --operations-file operations.json --json > proposal.json# Apply the saved proposalkater model edit query.orders --path FILE --apply-plan proposal.json --write --json- Keep ids intact. Keep source targets’ discovered relation ids and aliases as they are.
- Raw datetime fields. Use
--add-fields SOURCE.FIELD, and select the advertisedtimeframesoperations for truncation. - Redirects need your own terminal. The
> proposal.jsonredirect works in your own shell, not in the Files terminal or through an agent.
Document options
Document commands take --model REF, --at LINE:CHARACTER (zero-based UTF-16) and --text-file FILE where they apply. Completions require --at. Attached edits update the owning editor buffer. Standalone writes save files.
# Get completions at a position in an unsaved bufferkater model inspect FILE --feature completions --at LINE:CHARACTER --text-file TEXT_FILE