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

DAG fails to render if operation (on-run-* hook) has parents #229

Closed
jtcohen6 opened this issue Jan 10, 2022 · 1 comment · Fixed by #248
Closed

DAG fails to render if operation (on-run-* hook) has parents #229

jtcohen6 opened this issue Jan 10, 2022 · 1 comment · Fixed by #248
Assignees
Labels
bug Something isn't working

Comments

@jtcohen6
Copy link
Contributor

Describe the bug

If an operation (on-run-* project hook) depends on a model, it creates an entry for that operation in parent_map + child_map in manifest.json, which throws off the DAG rendering logic. It is possible to still use the DAG viz by adding --select criteria, i.e. by filtering out the operation node.

It's arguable whether operations should be included in parent_map + child_map, but isn't strictly wrong that they are. Changing that would require an artifact schema change. For now, it feels appropriate to handle this in the dbt-docs DAG rendering logic.

Steps To Reproduce

# dbt_project.yml
on-run-end:
  - "{{ reference_my_model() }}"
-- macros/reference_my_model.sql
{% macro reference_my_model() %}

    select 1 from {{ ref('my_model') }}

{% endmacro %}
-- models/my_model.sql
select 1 as id
$ dbt docs generate
$ dbt docs serve

Screenshot 2022-01-10 at 21 23 27

I haven't been able to successfully run npm on this machine, so I can't generate source maps and get a more helpful pointer to a specific line of code. That's definitely the thing to do first.

The output of dbt --version:
This fails in v1.0.1 and v0.21.1, so at least this isn't a regression in v1.0. But it's pretty obnoxious, and I bet the fix is straightforward, so I'd like to include in dbt-core==1.0.2 if we can.

@jtcohen6
Copy link
Contributor Author

It's possible my theory for the cause of this bug is incomplete—folks are seeing it even without on-run-end hooks, or on-run-end hooks that reference other resources. See slack threads for more details

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

Successfully merging a pull request may close this issue.

2 participants