Skip to main content
On this page

Kater CLI Build an analysis query

kater query reorder

Changes the order of the queries in a workspace, which is the order of its tabs.

Kater writes the new order into workspace.sql, and no query file changes.

Examples

Terminal window
# Get the revision of the ad_reporting workspace's query order
revision=$(echo '{"namespace": {"path": "connections/snowflake_prod_connection/workspaces/ad_reporting"}}' | kater query list --request-file - | jq -r .workspace_revision)
# Put spend_by_platform and paid_media_spend_trend first
jq -n --arg revision "$revision" '{namespace: {path: "connections/snowflake_prod_connection/workspaces/ad_reporting"}, names: ["spend_by_platform", "paid_media_spend_trend"], expected_revision: $revision}' | kater query reorder --request-file -
# Send a request that you keep in reorder.json
kater query reorder --request-file reorder.json

Arguments

ArgumentDescription
<path>Optional. In place of --request-file: the workspace, the query file or the chart file the request names.

Options

OptionDescription
--request-file <file>The JSON request. - reads it from standard input. See The request.

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

The request

KeyWhat it holds
namespaceThe workspace, by its path from the content root, such as {"path": "connections/snowflake_prod_connection/workspaces/ad_reporting"}.
namesThe workspace’s queries in their new order, by name. A query that the list leaves out keeps its place, after these.
expected_revisionThe workspace_revision that kater query list gives. Kater refuses the change when workspace.sql changed since.

See also