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

[Bug] Derived metric validation false positive on "identical input measures" #141

Open
2 tasks done
tlento opened this issue Sep 7, 2023 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@tlento
Copy link
Collaborator

tlento commented Sep 7, 2023

Is this a new bug in dbt-semantic-interfaces?

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

Current Behavior

Running validation on a model with a metric specified like so:

      metrics:
        - name: revenue
          alias: current_revenue
        - name: revenue
          offset_window: 1 month
          alias: revenue_prev_month

Prints this warning:

15:07:37  Running with dbt=1.6.1
15:07:37  Registered adapter: snowflake=1.6.2
15:07:38  PydanticMetric revenue_growth_mom has multiple identical input measures specifications for measure revenue. This might be hiding a semantic error. Input measure specification: name='revenue' filter=None alias=None.

The issue here is we are running the input measures validator on derived metrics without accounting for the fact that a derived metric is made up of multiple metrics which might themselves be sourced from shared measures.

There's nothing a user can do to fix this or act upon it. Indeed, nothing is even broken - in this case the user wants to compute some expr based on a transformation of the same input metric. That transformation and alias will naturally apply to the measure input on the metrics, but we can't detect that at this level, so we raise the validation warning about shared input measures (duh) with a baffling "alias: None" in there (because the input measures don't have aliases set).

Expected Behavior

We would expect this to pass validation cleanly, as nothing is wrong.

More generally, derived metric input validation should not be validating input measures. It should be validating input metrics.

Steps To Reproduce

Define a derived metric that relies on two distinct transformations of the same input metric (offset or filter) with aliases properly set and run the validation in a mode that will print warnings.

Relevant log output

No response

Environment

- OS:
- Python:
- dbt:
- dbt-semantic-interfaces:

Additional Context

No response

@tlento tlento added the bug Something isn't working label Sep 7, 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
Projects
None yet
Development

No branches or pull requests

1 participant