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-2696] Compilation error when rendering filter in metrics #7864

Closed
2 tasks done
Tracked by #7498
Jstein77 opened this issue Jun 13, 2023 · 1 comment · Fixed by #7885
Closed
2 tasks done
Tracked by #7498

[CT-2696] Compilation error when rendering filter in metrics #7864

Jstein77 opened this issue Jun 13, 2023 · 1 comment · Fixed by #7885
Assignees
Labels
bug Something isn't working semantic Issues related to the semantic layer

Comments

@Jstein77
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

I have a metric with a filter defined:

metrics:
  - name: "east_coast_order_amount"
    description: "Sum of orders from the east coast."
    type: simple
    label: "test"
    type_params:
      measures:
        - orders
    filter: |
      {{dimension('location_name')}} in ('Philadelphia')"

When I execute dbt run I get the following error:

Compilation Error
  Could not render {{dimension('location_name')}} in ('Philadelphia')
  : 'dimension' is undefined

This is likely due to the parser trying to render jinja when it encounters the double curlies, which it shouldn't be doing. If i escape the curlies dbt run succeeds. i.e

metrics:
  - name: "east_coast_order_amount"
    description: "Sum of orders from the east coast."
    type: simple
    label: "test"
    type_params:
      measures:
        - orders
    filter: |
      \{\{dimension('location_name')\}\} in ('Philadelphia')"

Expected Behavior

dbt should parse the filter correctly.

Steps To Reproduce

Define a filter in a semantic model and run dbt run.

Relevant log output

No response

Environment

- OS:
- Python:
- dbt:

Which database adapter are you using with dbt?

No response

Additional Context

No response

@Jstein77 Jstein77 added bug Something isn't working triage labels Jun 13, 2023
@Jstein77
Copy link
Author

cc @QMalcolm

@github-actions github-actions bot changed the title Compilation error when rendering filter in metrics [CT-2696] Compilation error when rendering filter in metrics Jun 13, 2023
@dbeatty10 dbeatty10 added semantic Issues related to the semantic layer and removed triage labels Jun 14, 2023
@QMalcolm QMalcolm added this to the v1.6 milestone Jun 14, 2023
@QMalcolm QMalcolm self-assigned this Jun 16, 2023
@jtcohen6 jtcohen6 removed this from the v1.6 milestone Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semantic Issues related to the semantic layer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants