Skip to content

metric_view in v1.12.0a1 source: {{ ref(...) }} compiles to quoted relation and fails YAML parsing #1361

@DanyloAntsybor

Description

@DanyloAntsybor

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

Python 3.12

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions