Skip to main content
On this page

Kater CLI Build an analysis filter

kater filter add

With --is-one-of or --is-not-one-of, --from-file reads IDs from a UTF-8 file of at most 1,000,000 bytes.

New lines, commas, spaces and tabs separate them, blank entries are dropped and repeated IDs are kept once. The file works for a key or a field with no key. An empty or unreadable file is refused. The value check reports how many IDs it found, and --allow-unseen keeps a value no row holds only when you ask for that.

Adds a filter on a field with one condition, as the + on the query does. With --workspace, it adds the filter to the workspace’s root, so every query of the workspace has it. A new filter starts on.

Examples

Terminal window
kater filter add orders_by_id order_id --is-one-of --from-file ids.txt
kater filter add orders_by_id order_id --is-one-of --from-file ids.txt --write
# Go to the ad_reporting workspace in your local copy of Kater content
cd connections/snowflake_prod_connection/workspaces/ad_reporting
# Show the SQL that the filter writes, and write nothing
kater filter add paid_media_spend_trend platform --is-one-of Google Meta
# Add the filter
kater filter add paid_media_spend_trend platform --is-one-of Google Meta --write
# Add a date filter for every query of the workspace
kater filter add paid_media_spend_trend date_day --is-on-or-after '3 months ago' --workspace --write
# Add a required filter, which a reader cannot switch off
kater filter add paid_media_spend_trend spend --is-at-least 0 --required --label "Spend is known" --write

Arguments

ArgumentDescription
<place>The query, as <workspace>/<name>, its key or its id, or the workspace, by its folder, its key or its id. Never a file.
<field>Optional. The field to filter, by its name, such as platform, or as alias.name for a field of a source.

Options

OptionDescription
--from-file <file>Read IDs from this UTF-8 file with --is-one-of or --is-not-one-of, up to 1,000,000 bytes. New lines, commas, spaces and tabs separate IDs; repeats are kept once.
--workspaceAdds the filter to the workspace’s root, so every query of the workspace has it.
--requiredWrites a REQUIRED_FILTER, which a reader cannot switch off.
--offStarts the filter off.
--label <text>The filter’s label on screen. By default it is the field’s label.
--name <name>The filter’s name. By default it is the field’s name, with _2 when that name is in use.
--description <text>What the filter keeps, in a sentence.
--ai-context <text>What an agent must know about the filter.
--allow-unseenKeeps values that no row holds yet. Without it, the command refuses such a value and names the values near it.
--completeWith --is-within-last: complete periods only, so the current period is not in the rows.
--request-file <file>The same request as JSON, such as {"field": "platform", "operation": "is_one_of", "values": ["Google"]}. - reads it from standard input.
--writeWrites the filter. Without it, the command shows the SQL that it writes, as a diff, and what it reaches.

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

See also