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

Recalculate metric depends_on in partial parsing #4298

Closed
jtcohen6 opened this issue Nov 17, 2021 · 0 comments · Fixed by #4299
Closed

Recalculate metric depends_on in partial parsing #4298

jtcohen6 opened this issue Nov 17, 2021 · 0 comments · Fixed by #4299
Assignees
Labels
bug Something isn't working partial_parsing

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented Nov 17, 2021

In partial parsing, when a metric's model is updated, the depends_on for metrics is not updated, even though refs is updated.

reproduction steps

Create any models model_a + model_b, then create a metric like:

# models/whatever.yml
version: 2
metrics:
  - model: ref('model_a')
    name: my_metric
    label: "My Metric"
    type: count
    sql: "*"
    timestamp: my_date
    time_grains: [day]

Good on the first go:

$ dbt --partial-parse ls --resource-type metric --output json --output-keys name,refs,depends_on
...
{"name": "my_metric", "depends_on": {"macros": [], "nodes": ["model.testy.model_a"]}, "refs": [["model_a"]]}

Then, edit the model property to be ref('model_b') instead.

$ dbt --partial-parse ls --resource-type metric --output json --output-keys name,refs,depends_on
...
{"name": "my_metric", "depends_on": {"macros": [], "nodes": []}, "refs": [["model_b"]]}
$ dbt --no-partial-parse ls --resource-type metric --output json --output-keys name,refs,depends_on
{"name": "my_metric", "depends_on": {"macros": [], "nodes": ["model.testy.model_b"]}, "refs": [["model_b"]]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working partial_parsing
Projects
None yet
2 participants