Overview of semantic views | Snowflake Documentation (original) (raw)

You can store semantic business concepts directly in the database in a semantic view, which is a new schema-level object. You can define business metrics and model business entities and their relationships. By adding business meaning to physical data, the semantic view enhances data-driven decisions and provides consistent business definitions across enterprise applications.

You can use semantic views in Cortex Analyst andquery these views in a SELECT statement. You can also share semantic views in private listings, in public listings on the Snowflake Marketplace, and in organizational listings.

Diagram illustrating how semantic views provide a more meaningful interface to tools and data

To create and manage semantic views, you can use SQL commands (such asCREATE SEMANTIC VIEW) or a wizard in Snowsight that guides you through the process of creating a semantic view.

Note

Semantic views are considered metadata.

Why use semantic views?

Semantic views address the mismatch between how business users describe data and how it’s stored in database schemas. For example, for a critical business concept like gross revenue, the data might be stored in a table column namedamt_ttl_pre_dsc in the database, making it difficult for business users to find and interpret.

Additionally, if net revenue within a company always means gross revenue after discounts, the semantic view can define it consistently as a metric with the correct aggregation: SUM(gross_revenue * (1 - discount)). This ensures a single authoritative definition with proper aggregation behavior. For example, when a user asks for “Net Revenue by Region,” the semantic view knows to aggregate at the appropriate level, whereas, without semantic views, dozens of inconsistent calculations might exist throughout different reports and applications, often with incorrect aggregation methods leading to erroneous results.

This business-focused abstraction layer solves several common problems:

Understanding semantic views

Note

Throughout this topic, database-related artifacts (such as database tables) are referred to as physical objects, and artifacts related to the semantic view are referred to as logical objects.

Within a semantic view, you define logical tables that typically correspond to business entities, such as customers, orders, or suppliers. You can define relationships between logical tables through joins on shared keys, enabling you to analyze data across entities (as you would when joining database tables).

Using logical tables, you can define:

In a semantic view, these three elements have distinct roles, but metrics and dimensions are the primary elements that you interact with when analyzing data through the semantic view. Facts provide the underlying row-level numerical data, metrics transform data into actionable insights through aggregation and calculation, and dimensions determine viewing perspectives.

Refer to thethe Key Concepts section in the semantic model specificationfor more information.

Interfaces for working with semantic views

You can use the following interfaces to create, manage, and use semantic views:

Limitations

Getting started

To get started with semantic views:

  1. Design your business data model.
    • What business entities exist in your data (for example, customers, products, orders, and so on)?
    • How do these entities relate to each other?
    • What metrics are important to your business?
    • What dimensions do you use to analyze these metrics?
  2. Map your business concepts to your physical data.
    • Which tables contain the data you need? We recommend starting with a simple star schema.
    • How will you join these tables?
    • What calculations are needed to derive your metrics?
  3. Create a semantic view.
    You can use one of these interfaces to create a semantic view.
  4. Use the semantic view in the following ways:

Additional information about semantic views

For additional information about semantic views, see the following topics:

For information about the privileges required to work with semantic views, see the following sections:

For reference information about the SQL commands and views for semantic views, see the following topics: