Skip to content
Back to skills

Snowflake Semantic Views

ASecurity

Create, inspect, and manage semantic views in Snowflake. Semantic views define the governed data model (entities, dimensions, metrics, relationships) that Cortex Analyst queries through.

  • 50 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 9, 2026
developmentgosqlexpressdatabase

Security analysis

A100/100

Scanned November 25, 2026

npx -y skills add Snowflake-Labs/snowflake-ai-kit --skill snowflake-semantic-views --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Snowflake Semantic Views?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Snowflake Semantic Views
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/snowflake-labs-snowflake-semantic-views/badge)](https://www.skillsdirectory.com/skills/snowflake-labs-snowflake-semantic-views)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: snowflake-semantic-views
description: >-
  Create, inspect, and manage semantic views in Snowflake. Semantic views
  define the governed data model (entities, dimensions, metrics, relationships)
  that Cortex Analyst queries through.
---

# Snowflake Semantic Views

Semantic views are the governed data model layer in Snowflake. They define entities, dimensions, metrics, time dimensions, and relationships over physical tables. Cortex Analyst generates SQL through these models.

## When to use

- User asks "what semantic views exist", "show me the data model"
- User wants to create or modify a semantic view
- User asks about available metrics, dimensions, or relationships
- User wants to validate a semantic model or add verified queries

## Discovery

**List semantic views:**
```sql
SHOW SEMANTIC VIEWS IN ACCOUNT;
-- or scoped:
SHOW SEMANTIC VIEWS IN SCHEMA my_db.my_schema;
```

**Describe a semantic view:**
```sql
DESCRIBE SEMANTIC VIEW my_db.my_schema.revenue_model;
```

## Creating a semantic view

Write the semantic model in YAML and create the view with `SYSTEM$CREATE_SEMANTIC_VIEW_FROM_YAML`. The view takes its name from `name` in the YAML. Pass `TRUE` as a third argument to validate without creating:

```sql
CALL SYSTEM$CREATE_SEMANTIC_VIEW_FROM_YAML('my_db.my_schema', $$
name: REVENUE_MODEL
tables:
  - name: ORDERS
    base_table:
      database: MY_DB
      schema: MY_SCHEMA
      table: ORDERS
    dimensions:
      - name: ORDER_ID
        expr: ORDER_ID
        data_type: NUMBER
      - name: CUSTOMER_NAME
        expr: CUSTOMER_NAME
        data_type: VARCHAR
      - name: REGION
        expr: REGION
        data_type: VARCHAR
    time_dimensions:
      - name: ORDER_DATE
        expr: ORDER_DATE
        data_type: DATE
    metrics:
      - name: TOTAL_REVENUE
        expr: SUM(AMOUNT)
        data_type: NUMBER
        description: Total revenue from orders
      - name: ORDER_COUNT
        expr: COUNT(*)
        data_type: NUMBER
        description: Number of orders
$$);
```

You can also use the SQL form, `CREATE SEMANTIC VIEW ... TABLES (...) DIMENSIONS (...) METRICS (...)`.

## Key concepts

- **Entities**: Logical tables in the model, mapped to physical base tables
- **Dimensions**: Columns you group by or filter on (categorical, text, numeric IDs)
- **Time dimensions**: Date/timestamp columns for time-series analysis
- **Metrics**: Aggregation expressions (SUM, COUNT, AVG, etc.)
- **Relationships**: Joins between entities (defined with join keys and relationship type)
- **Verified queries (VQRs)**: Pre-validated question-to-SQL pairs that improve Analyst accuracy

## Verified queries

VQRs teach Cortex Analyst the correct SQL for specific questions:

```yaml
verified_queries:
  - name: monthly_revenue
    question: "What is the monthly revenue?"
    sql: >-
      SELECT DATE_TRUNC('month', ORDER_DATE) AS month,
             SUM(AMOUNT) AS revenue
      FROM MY_DB.MY_SCHEMA.ORDERS
      GROUP BY month
      ORDER BY month
```

## Relationships (joins)

```yaml
relationships:
  - name: orders_to_customers
    left_table: ORDERS
    right_table: CUSTOMERS
    relationship_type: many_to_one
    relationship_columns:
      - left_column: CUSTOMER_ID
        right_column: ID
```

## Validation

After creating a semantic view:
1. `DESCRIBE SEMANTIC VIEW <name>` — verify it parsed correctly
2. Test through Cortex Analyst — ask a question that should hit the model
3. Compare the generated SQL against expected patterns
4. Add verified queries for important business questions

## Tips

- Keep entity names matching the physical table names for clarity
- Write clear `description` fields on metrics — Analyst uses them to pick the right metric
- Time dimensions should cover the primary date column for each fact table
- Start with 3-5 verified queries for the most common questions

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.