Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
Tracked by #8125
siljamardla opened this issue Aug 29, 2023 · 2 comments · Fixed by #8709 · May be fixed by #10437
Closed
2 tasks done
Tracked by #8125

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

siljamardla opened this issue Aug 29, 2023 · 2 comments · Fixed by #8709 · May be fixed by #10437
Assignees
Labels
backport 1.6.latest bug Something isn't working semantic Issues related to the semantic layer

Comments

@siljamardla
Copy link

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

@siljamardla siljamardla added bug Something isn't working triage labels Aug 29, 2023
@github-actions github-actions bot changed the title [Bug] Semantic Model yml does not support doc blocks (reuse of descriptions) [CT-3041] [Bug] Semantic Model yml does not support doc blocks (reuse of descriptions) Aug 29, 2023
@graciegoheen graciegoheen self-assigned this Aug 29, 2023
@graciegoheen
Copy link
Contributor

Hey thanks for catching this! We definitely want to support docs blocks in semantic model yml files.

@graciegoheen graciegoheen added enhancement New feature or request and removed bug Something isn't working triage labels Aug 29, 2023
@graciegoheen graciegoheen removed their assignment Aug 29, 2023
@QMalcolm QMalcolm added the semantic Issues related to the semantic layer label Aug 29, 2023
@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 8, 2023

This feels very similar to:

@jtcohen6 jtcohen6 changed the title [CT-3041] [Bug] Semantic Model yml does not support doc blocks (reuse of descriptions) [CT-3041] [Bug] Semantic Model nested element descriptions do not support doc blocks Sep 8, 2023
@graciegoheen graciegoheen added bug Something isn't working backport 1.6.latest and removed enhancement New feature or request labels Sep 11, 2023
@martynydbt martynydbt assigned aranke and unassigned gshank Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.6.latest bug Something isn't working semantic Issues related to the semantic layer
Projects
None yet
6 participants