> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# Semantic views

> Model a business domain once as tables, relationships, dimensions and metrics, then let BI tools, AI assistants and ad-hoc SQL query it by business name.

A semantic view is a business-level description of a part of your warehouse: which tables belong to
a domain, how they join, what counts as a metric or a dimension, and what business names people
actually use for them.

Without such an object that knowledge lives outside the database — in a BI semantic layer, a dbt
project, or a hand-maintained prompt — so every consumer re-implements the same join topology and
the same metric definitions, and they drift apart. A plain logical view does not close the gap
either: it can pre-join tables, but it cannot expose metrics as reusable aggregates, it cannot carry
the synonyms, comments and sample values an AI needs for grounding, and it fixes the join shape and
the grain at definition time.

A semantic view holds no data. When a query references it, it is inlined into the surrounding SQL as
a derived subquery built from its `RELATIONSHIPS` — with only the joins and the aggregation that the
query actually asks for.

This page is the task-oriented tour and the behavioural contract. The full syntax lives in
[CREATE SEMANTIC VIEW](/documents/4.2/sql-reference/sql-statements/semantic-view/CREATE_SEMANTIC_VIEW.md) and
[Querying Semantic Views](/documents/4.2/sql-reference/sql-statements/semantic-view/QUERY_SEMANTIC_VIEW.md).

## Quick start

### Step 1. Define the model

```SQL theme={null}
CREATE SEMANTIC VIEW sales_db.order_metrics
  TABLES (
    orders    AS sales_db.orders,
    customers AS sales_db.customer PRIMARY KEY (c_custkey)
      WITH SYNONYMS = ('client', 'account')
      COMMENT = 'One row per customer'
  )
  RELATIONSHIPS (
    orders_customer AS orders (o_custkey) INNER REFERENCES customers (c_custkey)
  )
  DIMENSIONS (
    customers.customer_name AS c_name
      WITH SYNONYMS = ('client name') COMMENT = 'Registered customer name'
  )
  METRICS (
    orders.total_price AS SUM(o_totalprice)
      WITH SYNONYMS = ('revenue', 'GMV') COMMENT = 'Sum of order totals'
  )
  COMMENT = 'Order revenue by customer';
```

### Step 2. Query it by business name

The join is the model's job, not the query's:

```SQL theme={null}
SELECT * FROM SEMANTIC_VIEW(
  sales_db.order_metrics
  METRICS    orders.total_price
  DIMENSIONS customers.customer_name
);
```

### Step 3. Verify before you trust it

```SQL theme={null}
-- Is the topology a snowflake, and where does each side's uniqueness come from?
EXPLAIN SNOWFLAKE SELECT * FROM SEMANTIC_VIEW(
  sales_db.order_metrics METRICS orders.total_price DIMENSIONS customers.customer_name);

-- What SQL does the query actually become?
EXPLAIN INLINE SELECT * FROM SEMANTIC_VIEW(
  sales_db.order_metrics METRICS orders.total_price DIMENSIONS customers.customer_name);
```

Then run the original SQL and the semantic-view query and compare the rows. A model is worth exactly
as much as that comparison.

### Step 4. Manage it

```SQL theme={null}
SHOW SEMANTIC VIEWS;                                 -- list, with comments and AI hints
SHOW SEMANTIC VIEW sales_db.order_metrics;           -- the same row for one view
SHOW CREATE SEMANTIC VIEW sales_db.order_metrics;    -- the definition as stored
DROP SEMANTIC VIEW IF EXISTS sales_db.order_metrics;
```

## Definition clauses at a glance

| Clause | Required | What it declares | Key constraints |
| - | - | - | - |
| `TABLES` | Yes | Base objects and their local aliases, with optional `PRIMARY KEY` / `UNIQUE` / `CONSTRAINT DISTINCT RANGE` | A base object may be a table, a logical view or a materialized view. A **semantic view may not** be a base table. |
| `RELATIONSHIPS` | No | One join edge per entry, from the referencing table to the referenced one | Must form a single snowflake. The referenced side of an equal join must be unique. Join type may be pinned per relationship. |
| `FACTS` | No | Row-level column expressions, exposed for detail queries | Available to `SEMANTIC_VIEW(... FACTS ...)` and to Style-2 references |
| `FILTER` | No | One boolean predicate applied to every query against the view | May name base-table columns, facts and dimensions; **may not** name a metric |
| `DIMENSIONS` | No | Grouping and filtering attributes | |
| `METRICS` | No | Reusable aggregates, optionally with `USING` and `NON ADDITIVE BY` | An aggregate metric is not available to detail queries; a window metric is |
| `COMMENT`, `WITH SYNONYMS`, `SAMPLE_VALUES` | No | Grounding metadata for AI and BI | Available on the view, its tables and each fact/dimension/metric |
| `AI_SQL_GENERATION`, `AI_QUESTION_CATEGORIZATION` | No | View-level instructions for a text-to-SQL assistant | |

## Rules enforced when the view is created

Each rule exists because breaking it produces a **wrong number rather than an error**. They are
checked at `CREATE` time — the only place where the cost of getting it wrong is a failed statement
instead of a report nobody questions. The checks live in the analyzer, so the SQL path and the
REST/YAML path are governed by the same rules.

| # | Rule | Rejected when | Why it is not merely a style rule |
| - | - | - | - |
| 1 | The referenced side of an **equal-join** relationship must be unique on the referenced columns | The columns cover no unique key | Each fact row then matches several rows and every aggregate crossing that relationship is inflated. On a two-table fixture whose true `SUM(amt)` is 35, such a view returned 50 |
| 2 | `TABLES` + `RELATIONSHIPS` must form a **single snowflake** | More than one alias has in-degree 0, some alias is unreachable from the root, a relationship points at itself, or the edges form a cycle | A query may take a metric from one part and a dimension from another; with no key path between them the generated SQL is a cross product or does not resolve |
| 3 | A **semantic view may not be a base table** | A base object names a semantic view | It has no column list of its own — its output columns exist only once a query inlines it. Expose it through a logical view first |
| 4 | `FILTER` must resolve | It names a metric, resolves to nothing, or resolves to more than one thing | Otherwise every query against the view fails later, far from the definition that caused it |

### Rule 1 in practice: when the dimension has no key

Do not declare a key that is not there — the engine believes the declaration. Expose the table
through a logical view that establishes one, and use that view as the base table:

```SQL theme={null}
CREATE VIEW sales_db.v_region AS
SELECT region_id, min(region_name) AS region_name
FROM sales_db.region_raw GROUP BY region_id;
```

Then verify the claim before relying on it:

```SQL theme={null}
SELECT region_id, count(*) FROM sales_db.v_region
GROUP BY region_id HAVING count(*) > 1 LIMIT 1;   -- any row returned means the key is false
```

Accepted uniqueness evidence:

| Base object | What establishes the key |
| - | - |
| Table | Primary-key, unique-key or aggregate-key columns; or the `unique_constraints` table property |
| Logical view or sub-query | The uniqueness its own `GROUP BY`, `SELECT DISTINCT`, or `ROW_NUMBER() OVER (PARTITION BY …) = 1` establishes |

`ASOF` and `BETWEEN` relationships are exempt from this rule.

### Rule 2 in practice: one view per snowflake

TPC-H and SSB are single snowflakes, rooted at `lineitem` and `lineorder`. TPC-DS is not: its six
sales and returns tables are six roots that merely share the dimension tables, so it needs **one
semantic view per channel**.

## Choosing the join type per relationship

Real snowflakes are not uniform. The relationship from a fact to a **mandatory** dimension is an
inner join — the row cannot exist without it — while the relationship to an **optional** dimension
must stay a left join or rows disappear.

```SQL theme={null}
RELATIONSHIPS (
  orders_customer AS orders (o_custkey) INNER REFERENCES customers (c_custkey),
  orders_promo    AS orders (o_promokey) LEFT  REFERENCES promotions (p_promokey)
)
```

| Written | Effect |
| - | - |
| `INNER` | Always inlined as an inner join |
| `LEFT` | Always inlined as a left outer join |
| Omitted | Follows the session variable `enable_semantic_view_inner_join` |

A pinned join type is stored with the relationship, so it survives a restart, is echoed by
`SHOW CREATE SEMANTIC VIEW`, and round-trips through the YAML API as `join_type`.

A relationship can also match on time rather than on equality. Several equal-join columns may be
combined with at most one `ASOF` or `BETWEEN` column, and the two cannot appear in the same
relationship — there the match rule, not key uniqueness, decides the grain. See
[CREATE SEMANTIC VIEW](/documents/4.2/sql-reference/sql-statements/semantic-view/CREATE_SEMANTIC_VIEW.md)
for the syntax.

## What a base table may be

A base object only has to expose a column list for the `FACTS` / `DIMENSIONS` / `METRICS`
expressions to resolve against, so a **logical view works wherever a table does** — on the fact
side, on the dimension side with auto-resolved join keys, when the view already aggregates, across
databases, and even when the view is itself defined over a semantic view.

That is what makes a model expressible when the raw tables are not shaped like a star: sink the
de-duplication, the one-sided filter or the expression join key into a logical view, and let the
semantic view reference it.

## Querying: two forms

| Form | Inlines as | Use it for |
| - | - | - |
| `SEMANTIC_VIEW(v METRICS …, DIMENSIONS …)` | Join topology **with** `GROUP BY` | The usual metric-by-dimension question |
| `SEMANTIC_VIEW(v FACTS …)` | Join topology **without** `GROUP BY`, keeping the root's grain | Ad-hoc SQL over the model, and joining two semantic views |

Normative rules for the two forms:

| Rule | Detail |
| - | - |
| `FACTS` cannot be combined with `METRICS` or `DIMENSIONS` | Raw rows and aggregated rows have different grains, so one access cannot ask for both |
| `HAVING` is rejected in the `FACTS` form | There is no aggregation to filter; the predicate belongs in `WHERE` |
| An aggregate metric is rejected in the `FACTS` form | It has no row-level value |
| A window metric is accepted in the `FACTS` form | A window function yields one value per row |
| `FACTS` accepts declared facts, dimensions and window metrics | At row level a dimension is a fact the model also groups by |
| The view-level `FILTER` applies to both forms | It is `AND`-ed with the query's own `WHERE` |
| `ORDER BY` inside `SEMANTIC_VIEW(...)` sorts the result | It applies whether or not a `LIMIT` is present |

A second form, a plain table-style reference, exposes the view's flat columns; see
[Style 2](/documents/4.2/sql-reference/sql-statements/semantic-view/QUERY_SEMANTIC_VIEW.md).

Several accesses of the same or different semantic views may appear in one query — self-joins,
`UNION ALL`, CTEs and sub-queries all work, which is what period-over-period reporting needs.

## Behaviour you can rely on

### Only the tables a query needs are joined

The inlined SQL joins the smallest connected set of tables covering what the query projects and
filters on, plus whatever is needed to connect them.

This matters for results, not only for speed. A customer asked "how many power stations are there"
over a view that also modelled devices; with every table joined, each station row was multiplied by
its device count and the count came back as the number of devices.

Two consequences to design for:

* **Reference declared facts, dimensions and metrics rather than base-table columns.** A predicate
  naming a base-table column directly (`WHERE o_orderstatus = 'F'`) skips pruning, because the model
  alone does not say which table owns that column.
* **A relationship you rely on as a filter is only joined when the query references it.** If an
  inner join is meant to drop non-matching rows, expose a field of that table and name it in the
  query; otherwise the filter disappears together with the pruned branch.

### A restated filter is not applied twice

A query that restates a conjunct of the view's `FILTER` in its own `WHERE` does not get that
predicate applied twice: repeated top-level `AND` conjuncts are dropped from the inlined `WHERE`.
This matters for generated SQL, which routinely restates the model's filter.

## Session variables

| Variable | Default | Effect |
| - | - | - |
| `enable_semantic_view_inner_join` | `false` | When `true`, relationships that did not pin a join type are inlined as `INNER JOIN` (and `ASOF LEFT JOIN` as `ASOF INNER JOIN`) |
| `enable_semantic_view_table_pruning` | `true` | When `false`, every declared table is joined, as releases before pruning existed did |
| `enable_semantic_view_table_pruning_on_inner_join` | `true` | When `false`, pruning applies only in the default left-join mode |

## Privileges

| Statement | Privilege |
| - | - |
| `CREATE SEMANTIC VIEW` | `CREATE VIEW` on the database |
| `DROP SEMANTIC VIEW` | `DROP` on the object |

DDL issued against a follower FE is forwarded to the leader, so semantic views can be created and
dropped from any FE.

## Inspecting a model and a query

| Statement | Answers |
| - | - |
| `EXPLAIN SNOWFLAKE <query>` | Is this query's topology a single snowflake, and what evidence makes each join safe? Metadata only — nothing is planned or executed |
| `EXPLAIN LINEAGE [JSON \| TEXT] <query>` | What is this query's substrate: relations, join edges with direction and evidence, unique keys and their source, outputs with the aggregate behind each, filters, de-duplication |
| `EXPLAIN INLINE <query>` | What SQL does the semantic-view reference expand into |

`EXPLAIN SNOWFLAKE` reports cases metadata cannot decide as explicit assumptions rather than
silently accepting them, and raises an error when the topology cannot be a snowflake — neither side
of an equal join unique, several independent snowflakes, an `ON` clause with no join key, or an
ASOF-shaped edge pointing at a side that is not unique.

`EXPLAIN LINEAGE` exists so that a tool does not have to re-implement a partial SQL parser outside
the server to answer "can this query be expressed as a semantic view". It is emitted as JSON by
default and as a PlantUML mindmap with `TEXT`.

## Grounding for AI and BI

| Clause | What it is for |
| - | - |
| `COMMENT` | What the element means in business terms |
| `WITH SYNONYMS` | The other names users say for it — paraphrases, abbreviations, jargon |
| `SAMPLE_VALUES` | A few representative values, so generated literals match the column's format |
| `AI_SQL_GENERATION` | View-level instructions for generating SQL against this model |
| `AI_QUESTION_CATEGORIZATION` | View-level hints for disambiguating questions |

Definitions can also be managed over REST, as the database native YAML or OSI Core Metadata Spec YAML —
see [Semantic View YAML REST API](/documents/4.2/sql-reference/semantic_view_yaml_api.md).

## See also

* [CREATE SEMANTIC VIEW](/documents/4.2/sql-reference/sql-statements/semantic-view/CREATE_SEMANTIC_VIEW.md)
* [Querying Semantic Views](/documents/4.2/sql-reference/sql-statements/semantic-view/QUERY_SEMANTIC_VIEW.md)
* [SHOW SEMANTIC VIEWS](/documents/4.2/sql-reference/sql-statements/semantic-view/SHOW_SEMANTIC_VIEWS.md)
* [SHOW CREATE SEMANTIC VIEW](/documents/4.2/sql-reference/sql-statements/semantic-view/SHOW_CREATE_SEMANTIC_VIEW.md)
* [DROP SEMANTIC VIEW](/documents/4.2/sql-reference/sql-statements/semantic-view/DROP_SEMANTIC_VIEW.md)
* [Semantic View YAML REST API](/documents/4.2/sql-reference/semantic_view_yaml_api.md)

## Persistent staging views

`TEMPORARY` marks a semantic view as staging (not published). It is persisted across restarts and is not tied to a session. Users with the required privileges can still query it by name. Applications can use the flag to control AI-agent discovery; it is not an access-control boundary.

`SHOW SEMANTIC VIEWS` lists published views. `SHOW ALL SEMANTIC VIEWS` lists both states; `SHOW TEMPORARY SEMANTIC VIEWS` lists staging views. The `Temporary` column distinguishes them. A named `SHOW SEMANTIC VIEW` can inspect either state.

Use `SET TEMPORARY = TRUE` or `FALSE` to change state. A rename can change the state atomically. `SWAP WITH` exchanges names while each object retains its staging state. `SHOW CREATE` reflects the current name and state. Existing views without the persisted flag remain published (`false`).

```sql theme={null}
CREATE TEMPORARY SEMANTIC VIEW sales_draft
TABLES (orders AS sales_db.orders)
METRICS (orders.total AS SUM(amount));

SHOW SEMANTIC VIEWS;
SHOW ALL SEMANTIC VIEWS;
SHOW TEMPORARY SEMANTIC VIEWS;
ALTER SEMANTIC VIEW sales_draft SET TEMPORARY = FALSE;
ALTER SEMANTIC VIEW sales_draft RENAME sales_next SET TEMPORARY = TRUE;
```

## Query semantic metadata with SQL

The internal catalog exposes six virtual tables in `information_schema`:

| Table | Metadata |
| - | - |
| `semantic_views` | Comment, AI hints, `TEMPORARY`, creation time and current SQL definition |
| `semantic_tables` | Logical aliases, source catalog/schema/table, primary and unique keys, synonyms and comments |
| `semantic_relationships` | Relationship name, source/target aliases, join type and column specifications |
| `semantic_dimensions` | Dimension definitions and attributes |
| `semantic_facts` | Fact definitions and attributes |
| `semantic_metrics` | Metric definitions, relationship usage and window/non-additive attributes |

Each table below lists its complete schema. List-valued attributes use JSON text, not SQL ARRAY values.

### `semantic_views`

One row per visible semantic view.

```sql theme={null}
SELECT * FROM information_schema.semantic_views;
```

| Column | Type | Description |
| - | - | - |
| `SEMANTIC_VIEW_CATALOG` | VARCHAR | Catalog containing the semantic view; `default_catalog`. |
| `SEMANTIC_VIEW_SCHEMA` | VARCHAR | Database containing the semantic view. |
| `SEMANTIC_VIEW_NAME` | VARCHAR | Current name of the owning semantic view. |
| `COMMENT` | VARCHAR | Comment stored for this semantic view. |
| `AI_SQL_GENERATION` | VARCHAR | View-level instructions for SQL generation. |
| `AI_QUESTION_CATEGORIZATION` | VARCHAR | View-level hints for question categorization. |
| `TEMPORARY` | BOOLEAN | `true` for a persistent staging view; `false` for a published view. |
| `CREATE_TIME` | DATETIME | Creation time in the session time zone; NULL when unavailable in legacy metadata. |
| `DEFINITION` | VARCHAR | Current CREATE SEMANTIC VIEW SQL, including the current name and staging state. |

### `semantic_tables`

One row per declared source table.

```sql theme={null}
SELECT * FROM information_schema.semantic_tables;
```

| Column | Type | Description |
| - | - | - |
| `SEMANTIC_VIEW_CATALOG` | VARCHAR | Catalog containing the semantic view; `default_catalog`. |
| `SEMANTIC_VIEW_SCHEMA` | VARCHAR | Database containing the semantic view. |
| `SEMANTIC_VIEW_NAME` | VARCHAR | Current name of the owning semantic view. |
| `TABLE_ALIAS` | VARCHAR | Logical table alias declared in the semantic view. |
| `TABLE_CATALOG` | VARCHAR | Catalog of the referenced source table. |
| `TABLE_SCHEMA` | VARCHAR | Database of the referenced source table. |
| `TABLE_NAME` | VARCHAR | Name of the referenced source table. |
| `PRIMARY_KEYS` | VARCHAR | Declared primary-key column names as a JSON array. |
| `UNIQUE_KEYS` | VARCHAR | Declared unique keys as a JSON array of column-name arrays. |
| `SYNONYMS` | VARCHAR | Declared synonyms as a JSON array. |
| `COMMENT` | VARCHAR | Comment stored for this source table. |

### `semantic_relationships`

One row per declared relationship.

```sql theme={null}
SELECT * FROM information_schema.semantic_relationships;
```

| Column | Type | Description |
| - | - | - |
| `SEMANTIC_VIEW_CATALOG` | VARCHAR | Catalog containing the semantic view; `default_catalog`. |
| `SEMANTIC_VIEW_SCHEMA` | VARCHAR | Database containing the semantic view. |
| `SEMANTIC_VIEW_NAME` | VARCHAR | Current name of the owning semantic view. |
| `RELATIONSHIP_NAME` | VARCHAR | Declared relationship name. |
| `FROM_TABLE` | VARCHAR | Logical alias of the referencing table. |
| `TO_TABLE` | VARCHAR | Logical alias of the referenced table. |
| `JOIN_TYPE` | VARCHAR | Explicit `INNER` or `LEFT`; NULL when the relationship follows the session default. |
| `COLUMN_SPECIFICATIONS` | VARCHAR | JSON array of join specifications: `kind` (`EQUAL`, `ASOF`, `BETWEEN`), `fromCol`, and `toCol` or `toStartCol`/`toEndCol`. |

### `semantic_dimensions`

One row per declared dimension.

```sql theme={null}
SELECT * FROM information_schema.semantic_dimensions;
```

| Column | Type | Description |
| - | - | - |
| `SEMANTIC_VIEW_CATALOG` | VARCHAR | Catalog containing the semantic view; `default_catalog`. |
| `SEMANTIC_VIEW_SCHEMA` | VARCHAR | Database containing the semantic view. |
| `SEMANTIC_VIEW_NAME` | VARCHAR | Current name of the owning semantic view. |
| `NAME` | VARCHAR | Semantic column name, qualified by its table alias when one is declared. |
| `TABLE_ALIAS` | VARCHAR | Logical table alias declared in the semantic view. |
| `EXPRESSION` | VARCHAR | Stored SQL expression defining the semantic column. |
| `ACCESS` | VARCHAR | Stored visibility: `PUBLIC`, `PRIVATE`, or `DEFAULT` when no modifier is stored. |
| `FILTER` | BOOLEAN | Whether the semantic column carries `LABELS = (FILTER)`; this is not the view-level FILTER predicate. |
| `SYNONYMS` | VARCHAR | Declared synonyms as a JSON array. |
| `COMMENT` | VARCHAR | Comment stored for this semantic column. |
| `SAMPLE_VALUES` | VARCHAR | Representative values as a JSON array of strings. |
| `USING_RELATIONSHIPS` | VARCHAR | Relationship names from the metric USING clause, as a JSON array. |
| `NON_ADDITIVE_BY` | VARCHAR | NON ADDITIVE BY sort expressions as a JSON array. |
| `WINDOW` | BOOLEAN | Whether the stored definition is a window metric. |
| `SEARCH_SERVICE` | VARCHAR | Search service declared for a dimension. |
| `SEARCH_COLUMN` | VARCHAR | Search column declared for that service. |
| `ORDINAL_POSITION` | BIGINT | One-based declaration position within this category of the owning semantic view. |

The three semantic-column tables share this schema. Attributes not declared for a column retain the SHOW defaults: empty strings, empty JSON arrays or `false`, as appropriate.

### `semantic_facts`

One row per declared fact.

```sql theme={null}
SELECT * FROM information_schema.semantic_facts;
```

| Column | Type | Description |
| - | - | - |
| `SEMANTIC_VIEW_CATALOG` | VARCHAR | Catalog containing the semantic view; `default_catalog`. |
| `SEMANTIC_VIEW_SCHEMA` | VARCHAR | Database containing the semantic view. |
| `SEMANTIC_VIEW_NAME` | VARCHAR | Current name of the owning semantic view. |
| `NAME` | VARCHAR | Semantic column name, qualified by its table alias when one is declared. |
| `TABLE_ALIAS` | VARCHAR | Logical table alias declared in the semantic view. |
| `EXPRESSION` | VARCHAR | Stored SQL expression defining the semantic column. |
| `ACCESS` | VARCHAR | Stored visibility: `PUBLIC`, `PRIVATE`, or `DEFAULT` when no modifier is stored. |
| `FILTER` | BOOLEAN | Whether the semantic column carries `LABELS = (FILTER)`; this is not the view-level FILTER predicate. |
| `SYNONYMS` | VARCHAR | Declared synonyms as a JSON array. |
| `COMMENT` | VARCHAR | Comment stored for this semantic column. |
| `SAMPLE_VALUES` | VARCHAR | Representative values as a JSON array of strings. |
| `USING_RELATIONSHIPS` | VARCHAR | Relationship names from the metric USING clause, as a JSON array. |
| `NON_ADDITIVE_BY` | VARCHAR | NON ADDITIVE BY sort expressions as a JSON array. |
| `WINDOW` | BOOLEAN | Whether the stored definition is a window metric. |
| `SEARCH_SERVICE` | VARCHAR | Search service declared for a dimension. |
| `SEARCH_COLUMN` | VARCHAR | Search column declared for that service. |
| `ORDINAL_POSITION` | BIGINT | One-based declaration position within this category of the owning semantic view. |

The three semantic-column tables share this schema. Attributes not declared for a column retain the SHOW defaults: empty strings, empty JSON arrays or `false`, as appropriate.

### `semantic_metrics`

One row per declared metric.

```sql theme={null}
SELECT * FROM information_schema.semantic_metrics;
```

| Column | Type | Description |
| - | - | - |
| `SEMANTIC_VIEW_CATALOG` | VARCHAR | Catalog containing the semantic view; `default_catalog`. |
| `SEMANTIC_VIEW_SCHEMA` | VARCHAR | Database containing the semantic view. |
| `SEMANTIC_VIEW_NAME` | VARCHAR | Current name of the owning semantic view. |
| `NAME` | VARCHAR | Semantic column name, qualified by its table alias when one is declared. |
| `TABLE_ALIAS` | VARCHAR | Logical table alias declared in the semantic view. |
| `EXPRESSION` | VARCHAR | Stored SQL expression defining the semantic column. |
| `ACCESS` | VARCHAR | Stored visibility: `PUBLIC`, `PRIVATE`, or `DEFAULT` when no modifier is stored. |
| `FILTER` | BOOLEAN | Whether the semantic column carries `LABELS = (FILTER)`; this is not the view-level FILTER predicate. |
| `SYNONYMS` | VARCHAR | Declared synonyms as a JSON array. |
| `COMMENT` | VARCHAR | Comment stored for this semantic column. |
| `SAMPLE_VALUES` | VARCHAR | Representative values as a JSON array of strings. |
| `USING_RELATIONSHIPS` | VARCHAR | Relationship names from the metric USING clause, as a JSON array. |
| `NON_ADDITIVE_BY` | VARCHAR | NON ADDITIVE BY sort expressions as a JSON array. |
| `WINDOW` | BOOLEAN | Whether the stored definition is a window metric. |
| `SEARCH_SERVICE` | VARCHAR | Search service declared for a dimension. |
| `SEARCH_COLUMN` | VARCHAR | Search column declared for that service. |
| `ORDINAL_POSITION` | BIGINT | One-based declaration position within this category of the owning semantic view. |

The three semantic-column tables share this schema. Attributes not declared for a column retain the SHOW defaults: empty strings, empty JSON arrays or `false`, as appropriate.

Every row carries `SEMANTIC_VIEW_CATALOG`, `SEMANTIC_VIEW_SCHEMA` and `SEMANTIC_VIEW_NAME` for its owning SV. Source table identities in `semantic_tables` use `TABLE_CATALOG`, `TABLE_SCHEMA` and `TABLE_NAME`. Collection-valued attributes are JSON text. Unavailable view/table/relationship scalar fields are SQL NULL; semantic column attributes retain the existing SHOW empty-string defaults. Creation time is a DATETIME when available; application-specific creators, update times and versions can remain in an ordinary business table.

If a legacy stored DDL batch cannot safely be mapped to one SV, `DEFINITION` is NULL while the other metadata remains queryable.

Quote SQL keyword column names with backticks, for example `` `AI_SQL_GENERATION` ``, `` `AI_QUESTION_CATEGORIZATION` `` and `` `WINDOW` ``.

Unlike the default SHOW list, `semantic_views` includes both published and staging objects. Filter `TEMPORARY` explicitly when selecting models for an AI agent. Access follows the existing semantic-view privileges.

Equality filters on the owning catalog, schema and SV name are applied in FE before expanding definitions, including when a BE scanner is used. Staging filters are also forwarded when recognized. Other SQL predicates, joins, ordering and limits retain their normal SQL semantics. Metadata is read with a short list snapshot and individual object locks; this is not a transactionally consistent snapshot of all objects during concurrent DDL.

`SHOW SEMANTIC TABLES FROM <sv>` and `SHOW SEMANTIC RELATIONSHIPS FROM <sv>` expose the corresponding definitions. Existing SHOW FACTS, DIMENSIONS and METRICS use the same stored definitions and column-attribute model.

```sql theme={null}
SELECT v.SEMANTIC_VIEW_NAME, v.COMMENT, v.TEMPORARY, e.creator
FROM information_schema.semantic_views v
JOIN app.sv_extensions e ON e.sv_name = v.SEMANTIC_VIEW_NAME
WHERE v.SEMANTIC_VIEW_CATALOG = 'default_catalog'
  AND v.SEMANTIC_VIEW_SCHEMA = 'sales_db'
  AND v.TEMPORARY = FALSE
ORDER BY v.CREATE_TIME DESC;
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.