SQL DDL Reference
Reference for Sidemantic SQL DDL blocks: MODEL, DIMENSION, METRIC, RELATIONSHIP, SEGMENT.
Sidemantic supports authoring semantic layers as SQL DDL blocks.
MODEL
MODEL (
name orders,
table orders,
primary_key id
);
DIMENSION
DIMENSION (
name created_at,
type time,
sql created_at,
granularity day
);
METRIC (Model-Level)
METRIC (
name revenue,
agg sum,
sql amount
);
RELATIONSHIP
RELATIONSHIP (
name customers,
type many_to_one,
foreign_key customer_id
);
SEGMENT
SEGMENT (
name completed,
sql {model}.status = 'completed'
);