Fix: prevent AttributeError when a DBT project is run with dbt-core >= 1.9.0#3668
Merged
Fix: prevent AttributeError when a DBT project is run with dbt-core >= 1.9.0#3668
Conversation
Collaborator
Author
|
Not easily because In my local environment, without this patch, if I force install After this patch: When our cicd environment starts resolving |
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.
Prior to this change, if SQLMesh tries to load a DBT project and
dbt-core==1.9.0or newer is in use, the following error occurs:The
Flagsbeing referred to are theproject_flagswhich we currently hardcode to None.This wasn't a problem until DBT 1.9.0 added a bunch of unguarded checks for
get_flags().state_modified_compare_more_unrendered_values.I checked where this was meant to be set in DBT and it turns out that
flags.set_from_args()will automatically include these default flags if bothproject_dirandprofiles_dirare specified.Today, we only specify
profiles_dir. It looks likeproject_diris expected to be the directory containingdbt_project.ymland it will merge values from theflagsmember of that config file with the hardcoded defaults.So this PR sets
project_dirto be passed toflags.set_from_args()which triggers the default ProjectFlags logic and SQLMesh runs successfully.Note: The reason that our CI hasnt picked this up already is because pip resolves
dbt-coreto version1.8.8whenmake install-cicd-testis run. This is due to conflicts in transitive dependencies. As such, im not entirely sure how to write an automated test for this without adding a bunch of complexity / test harnesses for multiple DBT versions