Add get_code_version to DagsterDbtTranslator #25387
Open
+52
−2
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.
Summary & Motivation
I wanted to use AutomationCondition.code_version_changed with dbt seeds. Unfortunately, from what I was able to determine, code_version is not set for seeds. Or maybe I should say it is, but all seeds have same value because function default_code_version_fn, that is used as a default, sets it based on “raw_sql” or “raw_code” from dbt_resource_props and what I saw for seeds, value of those is an empty string. That wouldn’t be a problem if there was a function like get_code_version in DagsterDbtTranslator that one can override. I didn’t find any open issue on that topic, so I decided to try to implement that.
It’s the first time I’m contributing to any open-source project. I tried to do my best to comply to any standards I could find so please be understanding 😊
How I Tested These Changes
I’ve added unit tests similar to other properties override by DagsterDbtTranslator like group_names in unit test test_with_group_replacements of test_asset_decorator.py module.
Changelog
Allow DagsterDbtTranslator to customize code_version