Problem
Most models use the same dialect for nearly every field and metric, so this gets repeated throughout the file:
expression:
dialects:
- dialect: ANSI_SQL
expression: SUM(orders.amount)
The repetition makes otherwise simple models harder to read and maintain.
Proposal
Allow a semantic model to declare a default dialect and use a string shorthand for expressions:
semantic_model:
- name: sales
default_dialect: ANSI_SQL
datasets:
- name: orders
source: analytics.orders
fields:
- name: amount
expression: amount
metrics:
- name: revenue
expression: SUM(orders.amount)
Explicit dialects would still be supported when an expression needs an override:
expression:
dialects:
- dialect: ANSI_SQL
expression: DATE_TRUNC('month', orders.created_at)
- dialect: SNOWFLAKE
expression: DATE_TRUNC('MONTH', orders.created_at)
Existing files would remain valid unchanged. The shorthand would only be allowed when default_dialect is present.
This is related to #52, but takes a smaller, backward-compatible approach: it keeps per-expression dialect overrides and scopes the default to each semantic model.
Problem
Most models use the same dialect for nearly every field and metric, so this gets repeated throughout the file:
The repetition makes otherwise simple models harder to read and maintain.
Proposal
Allow a semantic model to declare a default dialect and use a string shorthand for expressions:
Explicit dialects would still be supported when an expression needs an override:
Existing files would remain valid unchanged. The shorthand would only be allowed when
default_dialectis present.This is related to #52, but takes a smaller, backward-compatible approach: it keeps per-expression dialect overrides and scopes the default to each semantic model.