Skip to main content
On this page

Kater CLI Delete and restore

kater rm

Deletes objects, files and folders, as Delete in Kater does.

Each path is one change, and each delete goes to the Trash for 30 days. Run it with --dry-run first: it shows the plan that the Delete dialog shows, and changes nothing.

Examples

Terminal window
# Go to the snowflake_prod_connection connection
cd connections/snowflake_prod_connection
# See what the delete of the paid_media_ad_groups query affects, and Kater's plan for each part. Nothing changes.
kater rm workspaces/ad_reporting/query_contracts/paid_media_ad_groups.sql --dry-run
# Delete the query, with its chart and its tile, in one change
kater rm workspaces/ad_reporting/query_contracts/paid_media_ad_groups.sql
# Delete the query, and keep the dashboard's tile as it is: it shows Not available until someone fixes it
kater rm workspaces/ad_reporting/query_contracts/paid_media_ad_groups.sql --part connections/snowflake_prod_connection/workspaces/ad_reporting/dashboard.yaml#connections/snowflake_prod_connection/workspaces/ad_reporting/dashboard.yaml:866=keep
# Delete two charts, each as a change of its own
kater rm workspaces/ad_reporting/charts/spend_mix.sql workspaces/ad_reporting/charts/clicks_impressions_by_week.sql
# See the delete of a shared field, with engaged_sessions in its place
kater rm modeling/kater_objects/semantic_models/marketing/MARKETING_SESSIONS.sql#sessions --replace-with engaged_sessions --dry-run
# Delete a workspace of your own, with its queries, its charts and its dashboard, and tell the people who used it
kater rm users/yvonne@kater.ai/workspaces/lifecycle_brief_paid_media --tell

Arguments

ArgumentDescription
<path>What to delete, by its path from the folder you are in, or from --kater-root. A path that starts with connections/ is from the content root. A query’s or a chart’s .sql file, a workspace’s, an app’s or a project’s folder, a model’s .sql file, PATH#FIELD for a field of a model, or any other file or folder. Give one or more.

Options

OptionDescription
--dry-runShow the plan, as the Delete dialog shows it, and change nothing.
--replace-with <name>What reads in its place in each part that can read it, by its name, such as another field of the same model. --dry-run lists what can. Give it for one path only.
--part <id>=<fix>One part’s fix: ID=remove, ID=replace or ID=keep, with the part’s id as --dry-run prints it. keep leaves the part as it is, and it shows Not available. You can give it more than one time.
--pick-anywayWhere Kater could not decide what happens to a part, select its guess: the fix that leaves nothing showing Not available.
--delete-too <path>An object of your own that reads it. It goes to the Trash with it, in the same change. You can give it more than one time.
--tellTell the other people who used what it affects in the last 30 days, in their Kater inbox. Kater tells the owners of the work that it changes in all cases.

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

What goes with it

  • What goes with it. A query goes with its charts and their tiles. A workspace goes with its queries, its charts and its dashboard. A folder goes with everything in it.
  • What reads it stays. For each object that reads it, Kater removes each part that stands on its own, such as a chart or a follow-up, and a figure shows Not available. --part and --replace-with change this for a part.
  • Kater keeps rows with it. Rows such as its grants and pins stay with the delete, and come back when you restore it.
  • A field or a model of the shared layer can be retired in place of a delete. The plan says so, and kater retire keeps it working for what reads it.

When Kater stops

Kater prepares every path first. When one cannot go as asked, nothing is deleted.

  • Kater cannot decide what happens to a part. The command names the part. Give it a fix with --part, or let Kater select its guess with --pick-anyway.
  • Nothing has that name. --replace-with names something that cannot read in its place. The command lists what can.
  • Kater refuses the path. Kater says why, such as a file that you cannot change.
  • Kater is still looking. Kater looks for every place that reads a field or a model of the shared layer, and the command waits for up to 10 minutes. When the search takes longer, run the same command again in a minute.
  • You are not signed in. In your own terminal, the delete runs in Kater, so it needs kater login.

What it answers

For each path, it gives what it deleted and what went with it, what Kater changed in what reads it, and the delete’s id in the Trash. The last lines give the command that restores it, such as kater restore 3f1c9a20-5b7e-4d21-9a0e-1c2d3e4f5a6b, and the command that takes the change back, such as kater undo ch_3f9a21c0d4e5. When a part still shows Not available, it gives the kater trash fix command that fixes it. When Kater still writes the delete, it says so and gives the change’s id. kater git pull brings the delete to your local copy.

  • Agents ask first. An agent shows you --dry-run first, and deletes with kater_apply only after you say yes.

See also