While testing the new native metric_view support in v1.12.0a1, I found that source: {{ ref('...') }} inside a metric-view definition parses and compiles, but fails at runtime because the rendered relation is SQL-quoted with backticks, which Databricks metric-view YAML rejects.
Steps To Reproduce
Use a metric-view model like:
{{
config(
materialized='metric_view',
)
}}
version: 1.1
source: {{ ref('your_model') }}
dimensions:
- name: some_dim_col
expr: dim_col
measures:
- name: total_col_name
expr: SUM(col_name)
Run:
dbt run -s test_metric_view
Actual behavior
The model compiles, but source: renders to a quoted relation such as:
source: `catalog_name`.`schema_name`.`model_name`
Databricks then rejects the metric-view YAML at runtime with:
[METRIC_VIEW_INVALID_VIEW_DEFINITION] Failed to parse YAML:
found character '`' that cannot start any token
Expected behavior
I would expect source: {{ ref('your_model') }} to work end-to-end in a native metric_view implementation.
Workaround
This works:
source: {{ ref('your_model').database }}.{{ ref('your_model').schema }}.{{ ref('your_model').identifier }}
because it renders to an unquoted three-part name.
System information
dbt --version
Core:
- installed: 1.11.6
Plugins:
- databricks: 1.12.0a1
python --version
While testing the new native
metric_viewsupport inv1.12.0a1, I found thatsource: {{ ref('...') }}inside a metric-view definition parses and compiles, but fails at runtime because the rendered relation is SQL-quoted with backticks, which Databricks metric-view YAML rejects.Steps To Reproduce
Use a metric-view model like:
{{ config( materialized='metric_view', ) }} version: 1.1 source: {{ ref('your_model') }} dimensions: - name: some_dim_col expr: dim_col measures: - name: total_col_name expr: SUM(col_name)Run:
Actual behavior
The model compiles, but
source:renders to a quoted relation such as:Databricks then rejects the metric-view YAML at runtime with:
Expected behavior
I would expect
source: {{ ref('your_model') }}to work end-to-end in a nativemetric_viewimplementation.Workaround
This works:
because it renders to an unquoted three-part name.
System information
dbt --versionpython --version