DuckDB Semantic Views

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, Databricks calls them Metric Views, both as a SQL syntax sugar for a special kind of flexible view-like interface over aggregated metrics and dimensions. This extension brings the same idea to DuckDB, using DDL syntax modeled closely on Snowflake’s CREATE SEMANTIC VIEW.

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
DDL reference

Full syntax for CREATE SEMANTIC VIEW and related DDL.

CREATE SEMANTIC VIEW
How-to guides

FACTS, derived metrics, role-playing dimensions, fan traps, data sources.

How-To Guides
Snowflake comparison

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

Snowflake Comparison
Query reference

Reference for semantic_view() and explain_semantic_view().

semantic_view()