DuckDB Semantic Views

The semantic layer for your

A Semantic Layer sits between your raw tables and the people querying them. Instead of everyone writing their own SUM(amount) and hoping they GROUP BY the same columns, you define each metric and dimension once, in one place. Analysts pick the ones they want; the system assembles the SQL.

Snowflake and Databricks, along with dbt Cloud, Cube.dev and others, all ship semantic layers in different forms. Snowflake has Semantic Views and Databricks has Metric Views. Both expose the semantic layer as a SQL object: a view-like interface over metrics and dimensions that you can query in any combination. This extension brings the same idea to DuckDB, using DDL syntax modeled closely on Snowflake’s CREATE SEMANTIC VIEW. You query a view the ways Snowflake does: with the same SEMANTIC_VIEW(...) construct, or by name with an ordinary SELECT region, AGG(revenue) FROM ... GROUP BY region (see How to Query a Semantic View with Standard SQL).

Getting started

Install the extension, create your first semantic view, and run a query in 5 minutes.

Getting Started
Multi-table semantic views

Model relationships between tables and query across them.

Multi-Table Semantic Views
Building a complete model

Facts, derived metrics, and iterative model refinement in 15 minutes.

Building a Complete Model
DDL reference

Full syntax for CREATE SEMANTIC VIEW and related DDL.

CREATE SEMANTIC VIEW
How-to guides

Modeling, advanced metrics, data sources, materializations, YAML definitions, and more.

How-To Guides
Snowflake comparison

Feature-by-feature comparison with Snowflake’s CREATE SEMANTIC VIEW.

Snowflake Comparison

If you are building a tool or an agent on top of the extension, every function it registers describes itself in DuckDB’s duckdb_functions() listing, with its parameter names and an example call. Functions lists them and shows the query to run.