Skip to main content
On this page

Kater CLI Present and share

kater add-to

Adds a query, a chart or a workspace to dashboards, apps and projects, as **Add to** does everywhere in Kater.

With no --to, it lists every place where it can go, with the --to that adds it there.

Examples

Terminal window
# Go to the snowflake_prod_connection connection
cd connections/snowflake_prod_connection
# List the places where the spend_mix chart can go
kater add-to workspaces/ad_reporting/spend_mix
# Add the chart to the Paid Media Review dashboard and to a new app, in one add
kater add-to workspaces/ad_reporting/spend_mix --to workspace:workspaces/paid_media_review --to new:apps --name "Spend review"
# Copy the spend_by_platform query into a new workspace of yours
kater add-to workspaces/ad_reporting/spend_by_platform --to new:dashboards --name "Spend review"
# Add statement 2 of a scratch file, with its chart, to the ad_reporting dashboard
kater add-to users/you@example.com/brainstorm/sandbox/live_session_check.sql --statement 2 --to workspace:workspaces/ad_reporting
# Add the Explore cards in cards.json, each with its chart, to the ad_reporting dashboard
kater add-to --cards cards.json --to workspace:workspaces/ad_reporting
# Open the query in a new scratch file in the Sandbox
kater add-to workspaces/ad_reporting/spend_by_platform --sandbox

Arguments

ArgumentDescription
<subject>Optional. What to add: a chart or a query as <workspace>/<name> or by its id (a name is the chart when the workspace has a chart of that name, else the query), a workspace by its folder or its id, a scratch file with --statement, a page (an .html file), which goes into an app, or an app’s folder, which goes into a project. Give a path from the folder you are in, or from --kater-root. Leave it out with --cards.

Options

OptionDescription
--cards <file>Explore cards to add, as JSON, from a file. - reads stdin. Give a list of cards, or a request that holds them as cards, or one as card, as kater explore tour --json and kater explore card create give them. Each card must read the same shared model. See Cards.
--to <place>A place to add it to, as the list names it. Give it again for each place: one add adds to all of them. See The places. You can give it more than one time.
--name <text>The name of the new dashboard’s workspace or the new app, with --to new:dashboards or --to new:apps. Its folder takes the same name, with _2 added when that name is taken.
--statement <n>For a scratch file: the statement to add, by its number in the file, counting from 0.
--label <text>For --statement: the name of the query it becomes, and of its chart. Leave it out to use the statement’s title.
--chart, --no-chartFor --statement and --cards: adds the query alone, into the workspace, without the chart that the file keeps for the statement, or that each card has.
--search <words>Lists only the places whose name, label or path holds these words. A tab lists its first 200 places, and this finds the others.
--sandboxOpens your draft of the query in the Sandbox: a scratch file in your brainstorm folder.

It also takes the global options anywhere on the line, and --help.

The places

  • workspace:FOLDER. A workspace’s dashboard. A chart goes on the dashboard as a tile. A query goes into the workspace. When the workspace is not its own, the add first copies the query, and a chart’s query, into the workspace’s queries/, under its own name, or with _2 when that name is taken. The copy reads the workspace’s root, so every filter of that dashboard holds its rows. Its copied_from names the original.
  • app:FOLDER. An app. A query goes at the end of its first page as a table, and a chart as the tag that draws its kind. A page goes in as another page of the app.
  • project:ID. A project, which lists it.
  • new:dashboards and new:apps. A new workspace with a dashboard, or a new app, in your own folder. A new workspace starts from the root of the query’s workspace.

A workflow takes it as a step that you write in the workflow. The list says how to open each one.

The list

With no --to, it lists the places on each tab, as Add to shows them: Dashboards, Apps, Projects and Workflows. The dashboard of its own workspace comes first. Each place says one of these:

  • The --to that adds it there. “Not checked yet” means that nobody checked the copy there yet. The add checks it.
  • Already added. The place holds it already, so the add leaves it as it is. To take it out, use kater files remove-from or kater project remove.
  • Cannot take it. The place reads another shared model or none, or the copy does not compile there. The command says why.

How the add runs

The add changes every place in one change, and the command waits until it is done. It then says what it added at each place, with a path to open it. A place that cannot take it says why, and the other places still get it. In a local copy, the command makes the change and brings it into your copy.

Through an agent

The kater tool of the Kater MCP lists the places. An agent adds it with kater_apply after the person agrees where.

See also