SimetrikDocs
ReferenceTransforms

segment

Subcommands of simetrik segment.

simetrik segment create

Create a segment (filtered view) on a source or union.

Creates a segment — a filtered view over a source or union, identified by its <resource_id>. A segment names a subset of rows so you can reuse it downstream (for example as an input to a union or reconciliation). Pass --name and, optionally, --filters to define the subset.

--filters accepts three shapes: a JSON object with an expression key holding a SQL-like string (for example STATUS = 'ok' AND AMOUNT > 100), a JSON object with a rules key (one structured filter set), or a JSON array of structured filter sets. Each column_name you reference is resolved to its column ID against the resource before the request is sent; an unrecognized name fails locally with code 2. Note that --name is enforced at runtime and exits with code 1 (not 2) when omitted. Reach for this when you need a saved filtered view; to rename it later use simetrik segment update, and to inspect its filters use simetrik segment describe.

See also: segment update, segment describe, union create. Requires the resources · create_edit permission. See permissions.

Arguments

  • resource_id — Resource ID

Flags

  • -n, --name <n> — Segment name
  • --filters <json> — Filter definition (expression JSON or structured filter sets JSON)
  • -f, --format <fmt> — Output format: table|json

Examples

simetrik segment create 100 --name "Solo aprobados"
simetrik segment create 100 --name "USD enero" --filters '{"expression":"CURRENCY = ''USD'' AND STATUS IN (''ok'',''done'')"}'
simetrik segment create 100 --name "Sin nulos" --filters '[{"condition":"AND","rules":[{"column_name":"AMOUNT","operator":"is_nnull","value":null,"condition":"AND","rule_type":1}]}]'

Exit codes

CodeMeaning
0Segment created
1Missing --name, or API error (resource not found / segment rejected)
2Invalid input — malformed --filters JSON, or a filter column_name that does not match any column on the resource
4Authentication required — run simetrik login

simetrik segment update

Rename an existing segment (only the name; filters are immutable after creation).

Renames an existing segment, identified by its <segment_id>. Pass the new label with -n/--name. This command only touches the segment's name — it does not change the filter rules that define which rows the segment contains.

Use this when a segment's purpose or naming convention changes; to alter the rows a segment captures you must recreate it with simetrik segment create, since the filters are set at creation. To see a segment's current name and filters before renaming, use simetrik segment describe.

See also: segment create, segment describe. Requires the resources · create_edit permission. See permissions.

Arguments

  • segment_id — Segment ID

Flags

  • -n, --name <n> — New segment name
  • -f, --format <fmt> — Output format: table|json

Examples

simetrik segment update seg_42 --name "Aprobados Q1"

Exit codes

CodeMeaning
0Segment updated
1API error — segment not found or update rejected
2Invalid input — bad segment ID
4Authentication required — run simetrik login

simetrik segment describe

Describe a segment with filter_sets and rules inline.

Returns the full definition of a segment, identified by its <segment_id>, including its filter_sets and the individual filter rules inline. Use this to inspect exactly which rows a segment captures and how its filters are structured.

Reach for describe when you need the detail of one segment — its rules and conditions — rather than just discovering that it exists. The default json output is the easiest to parse when verifying a segment created with simetrik segment create; --format table gives a quick visual read.

See also: segment create, segment update. Requires CLI access. See permissions.

Arguments

  • segment_id — Segment ID

Flags

  • -f, --format <fmt> — Output format: json|table

Examples

simetrik segment describe seg_42
simetrik segment describe seg_42 --format table

Exit codes

CodeMeaning
0Segment details returned
1API error — segment not found
2Invalid input — bad segment ID
4Authentication required — run simetrik login

On this page