Skip to main content

Semantic models

Tip
Use dbt Copilot, available for dbt Enterprise and Enterprise+ accounts, to generate semantic models in the Studio IDE only.

Semantic models are the foundation for data definition in MetricFlow, which powers the Semantic Layer:

📹 Learn about the dbt Semantic Layer with on-demand video courses!

Explore our dbt Semantic Layer on-demand course to learn how to define and query metrics in your dbt project.

Additionally, dive into mini-courses for querying the dbt Semantic Layer in your favorite tools: Tableau, Excel, Hex, and Mode.

Here we describe the Semantic model components with examples:

Semantic models components​

The complete spec for semantic models is below:

The following example displays a complete configuration and detailed descriptions of each field:

Description​

Includes important details of the semantic model. This description will primarily be used by other configuration contributors. You can use the pipe operator (|) to include multiple lines in the description.

Primary entity​

You can define a primary entity using the following configs:

Here are the types of keys:

  • Primary — Only one record per row in the table, and it includes every record in the data platform.
  • Unique — Only one record per row in the table, but it may have a subset of records in the data platform. Null values may also be present.
  • Foreign — Can have zero, one, or multiple instances of the same record. Null values may also be present.
  • Natural — A column or combination of columns in a table that uniquely identifies a record based on real-world data. For example, the sales_person_id can serve as a natural key in a sales_person_department dimension table.

Dimensions​

Dimensions are different ways to organize or look at data. They are effectively the group by parameters for metrics. For example, you might group data by things like region, country, or job title.

Dependencies​

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading