SHOW COLUMNS IN SEMANTIC VIEW¶
Lists all queryable columns in a semantic view – dimensions, facts, and metrics – with their data types, expressions, kind, and comments. Private items are excluded from the output.
Syntax¶
SHOW COLUMNS IN SEMANTIC VIEW <name>
Parameters¶
<name>The name of the semantic view. Returns an error if the view does not exist.
Output Columns¶
Returns one row per queryable column with 8 columns:
Column |
Type |
Description |
|---|---|---|
|
VARCHAR |
The DuckDB database containing the semantic view. |
|
VARCHAR |
The DuckDB schema containing the semantic view. |
|
VARCHAR |
The semantic view name. |
|
VARCHAR |
The dimension, fact, or metric name. |
|
VARCHAR |
The inferred data type. Empty string if not resolved. |
|
VARCHAR |
The column kind: |
|
VARCHAR |
The SQL expression defining the column. |
|
VARCHAR |
The comment text. Empty string if no comment is set. |
Kind Values¶
Kind |
Description |
|---|---|
|
A grouping expression from the |
|
A row-level expression from the |
|
A base metric (scoped to a table) from the |
|
A derived metric (no table alias, references other metrics) from the |
PRIVATE Exclusion¶
Metrics and facts marked PRIVATE are excluded from the output. Only PUBLIC items (the default) appear. This matches the behavior of wildcard expansion in semantic_view() queries.
Sort Order¶
Rows are sorted by kind (alphabetically: DERIVED_METRIC, DIMENSION, FACT, METRIC) and then by column_name within each kind.
Examples¶
CREATE SEMANTIC VIEW shop AS
TABLES (o AS orders PRIMARY KEY (id))
FACTS (o.raw_amount AS o.quantity * o.price COMMENT = 'Line total')
DIMENSIONS (o.region AS o.region)
METRICS (
o.revenue AS SUM(o.quantity * o.price),
avg_order AS revenue / COUNT(*)
);
SHOW COLUMNS IN SEMANTIC VIEW shop;
┌───────────────┬─────────────┬────────────────────┬─────────────┬───────────┬────────────────┬───────────────────────────┬────────────┐
│ database_name │ schema_name │ semantic_view_name │ column_name │ data_type │ kind │ expression │ comment │
├───────────────┼─────────────┼────────────────────┼─────────────┼───────────┼────────────────┼───────────────────────────┼────────────┤
│ memory │ main │ shop │ avg_order │ DOUBLE │ DERIVED_METRIC │ revenue / COUNT(*) │ │
│ memory │ main │ shop │ region │ VARCHAR │ DIMENSION │ o.region │ │
│ memory │ main │ shop │ raw_amount │ DOUBLE │ FACT │ o.quantity * o.price │ Line total │
│ memory │ main │ shop │ revenue │ BIGINT │ METRIC │ SUM(o.quantity * o.price) │ │
└───────────────┴─────────────┴────────────────────┴─────────────┴───────────┴────────────────┴───────────────────────────┴────────────┘
Error: view does not exist:
SHOW COLUMNS IN SEMANTIC VIEW nonexistent;
Error: Semantic view 'nonexistent' not found