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

[dagster-dbt] updates default_code_version_fn to take from dbt checksum if available #26071

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

marijncv
Copy link
Contributor

Summary & Motivation

This updates the default_code_version_fn in dagster-dbt to read from dbt_resource_props["checksum"]["checksum"] if available (suggested here). This gives dbt seeds a valid model version.

An alternative implementation could be to always read from the checksum field and ignore the raw_sql and raw_code fields. This would simplify the code version getter, but this would cause all current code versions of dbt models to be updated. Perhaps something for a breaking release?

Closes #25947

How I Tested These Changes

Added test

Changelog

dagster-dbt now gives dbt seeds a valid code version

Copy link
Contributor

@OwenKephart OwenKephart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @marijncv ! Thanks for the submission. This definitely makes sense as a feature. If we were starting from scratch, it'd probably make sense to just use the checksum for all cases, but this would be a fairly rough breaking change.

Overall, I'm in favor of this change, just had a minor comment on style

return hashlib.sha1(code.encode("utf-8")).hexdigest()

return (
dbt_resource_props["checksum"]["checksum"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for style consistency, this can be return dbt_resource_props.get("checksum", {}).get("checksum")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support code_version for dbt seeds by default
2 participants