DuckDB Semantic Views
Overview
Tutorials
Getting Started
Install the extension and run your first query in 5 minutes
Multi-Table Semantic Views
Model multi-table schemas with relationships
Building a Model
Build a realistic model with facts and derived metrics
How-To Guides
FACTS
Define reusable row-level expressions referenced in metrics
Derived Metrics
Compose metrics from other metrics using arithmetic
Role-Playing Dimensions
Join the same table multiple times with distinct aliases
Fan Traps
Detect and resolve aggregation inflation from one-to-many joins
Data Sources
Connect CSV, Parquet, Iceberg, and database tables to semantic views
Filtering
Filter before aggregation with where_clause or after it with an outer WHERE
Metadata Annotations
Add comments, synonyms, and access modifiers to view definitions
Semi-Additive Metrics
Define snapshot metrics with NON ADDITIVE BY for balances and inventory
Window Metrics
Define rolling averages, lag comparisons, and rankings with OVER clauses
Wildcard Selection
Select all items for a table alias using alias.* patterns
Query Facts
Query facts directly as row-level columns without aggregation
Materializations
Route matching queries to pre-aggregated tables
YAML Definitions
Export and import semantic view definitions as YAML
Explanation
Semantic Views vs Regular Views
What semantic views add beyond standard SQL views
Metric Grain
Why each metric aggregates at its own grain and how multi-grain queries are assembled
Snowflake Comparison
Feature comparison with Snowflake SQL DDL semantic views
Databricks Comparison
Feature comparison with Databricks metric views
Transactional DDL and Limitations
How DDL participates in transactions, plus read-only and concurrency caveats
Reference
Release notes
/
Index