Skip to content

[CT-3041] [Bug] Semantic Model nested element descriptions do not support doc blocks #8509

Closed
@siljamardla

Description

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

The semantic model has entities, measures and dimensions. Each of these can have name, description etc.
Writing a manual description works, but re-using a predefined description does not work. Compilation fails with

12:51:01  Running with dbt=1.6.0
12:51:02  Registered adapter: databricks=1.6.1
12:51:02  Encountered an error:
Compilation Error
  Could not render {{ doc('orders_created') }}: 'doc' is undefined

Yes, I am absolutely sure the doc block referenced does exist as it is used in the metric description as well.

Expected Behavior

As everywhere else in dbt, I would expect DRY and I would expect to be able to reuse descriptions.

Steps To Reproduce

Semantic model that compiles:

semantic_models:
  - name: orders
    defaults:
      agg_time_dimension: created_date_local
    description: Some description
    model: ref('orders')
    # Entities. These usually corespond to keys in the table.
    entities:
      - name: order_key
        description: Manual description
        type: primary
      - name: city
        type: foreign
        expr: city_id
    # Measures. These are the aggregations on the columns in the table.
    measures:
      - name: orders_created
        description: Manual description
        expr: 1
        agg: sum
    # Dimensions. Either categorical or time.
    dimensions:
      - name: created_date_local
        description: Manual description
        type: time
        type_params:
          time_granularity: day 
      - name: city_id
        type: categorical

and this does not compile

semantic_models:
  - name: orders
    defaults:
      agg_time_dimension: created_date_local
    description: Some description
    model: ref('orders')
    # Entities. These usually corespond to keys in the table.
    entities:
      - name: order_key
        description: "{{ doc('orders_created') }}"
        type: primary
      - name: city
        type: foreign
        expr: city_id
    # Measures. These are the aggregations on the columns in the table.
    measures:
      - name: orders_created
        description: "{{ doc('orders_created') }}"
        expr: 1
        agg: sum
    # Dimensions. Either categorical or time.
    dimensions:
      - name: created_date_local
        description: "{{ doc('orders_created') }}"
        type: time
        type_params:
          time_granularity: day 
      - name: city_id
        type: categorical

I have tested the descriptions of entities, measures and dimensions separately as well, none of them accept the doc block.

Relevant log output

No response

Environment

- OS: Mac OS
- Python: 3.9.17
- dbt: 1.6.0

Which database adapter are you using with dbt?

spark

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions