Allow a default dialect at the semantic model level
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 267
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 24
Description
## Problem
Most models use the same dialect for nearly every field and metric, so this gets repeated throughout the file:
```yaml
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:
```yaml
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:
```yaml
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.
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating the semantic-model schema and validation paths for default_dialect and both expression forms. Done means models with a default accept string expressions, explicit dialect overrides still work, and existing files remain valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100