Skip to main content
canonic sl exposes the semantic-layer capabilities directly: useful for debugging what a metric resolves to or what SQL a query compiles down to, without executing anything.
With --json, each of these commands’ output matches its corresponding MCP tool payload byte-for-byte (resolve_metric, compile_query, describe_metric).

sl resolve

Resolve a name to its canonical binding.
Prints the resolved metric, owning source, measure, and binding kind. With --json the payload also carries kind, components and population_filter. For a composite metric (ratio, weighted_avg) source and measure are null and components names the numerator, the denominator and the on_zero_denominator policy:

sl compile

Compile a semantic query to SQL + metadata without executing it.
--metrics/--dimensions/--filter/--via/--limit/--time-range and -f are mutually exclusive, same as canonic query. See canonic query for the full filter syntax. The flags build the identical SemanticQuery a JSON file would deserialize: {"metrics": [...], "dimensions": [...], "filters": [...], "via": [...], "limit": null}. Output includes the target dialect, the compiled SQL, resolved bindings, and any guardrails that fired.

sl describe

Return grain, dimensions, measures, and freshness for one metric.
Prints the metric’s source, grain, dimensions, freshness (last_validated_at), and any worked examples on file. For a composite metric there is no single source. --json then returns kind, components and population_filter as for sl resolve, measures lists the measures its components read, and grain is the shared grain when both components sit on one source, otherwise empty.