Fix: Dependency handling when converting on-run-start / on-run-end hooks in dbt projects#4567
Merged
izeigerman merged 2 commits intomainfrom May 28, 2025
Merged
Conversation
…oks in dbt projects
tobymao
approved these changes
May 28, 2025
themisvaltinos
approved these changes
May 28, 2025
Contributor
themisvaltinos
left a comment
There was a problem hiding this comment.
the change looks good, but I noticed an issue in the _load_environment_statements which is my mistake that environment_statements is overwritten on each iteration of the loop so it doesn’t accumulate EnvironmentStatements across multiple projects. I believe to fix this we should replace the assignment with:
environment_statements.extend(
statements
for _, statements in sorted(
hooks_by_package_name.items(),
key=lambda item: 0 if item[0] == context.project_name else 1,
)
)and properly indent it. But if not addressed here, I can handle this in a subsequent PR
Contributor
Author
|
@themisvaltinos good catch. I've addressed your comment but keep in mind the following:
|
b25bc60 to
6163ef3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, the conversion process didn't handle refs and sources in
on-run-start/on-run-endhooks. This fix addresses the issue by sourcing ref and source dependencies directly from the manifest, in addition to extracting them by statically analyzing the hook's Jinja code.