-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add PrefectDbtSettings
to prefect-dbt
#16834
Conversation
CodSpeed Performance ReportMerging #16834 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new settings class and discriminator look good! I have one question/comment about the new before validator.
@field_validator("target_configs", mode="before") | ||
@classmethod | ||
def handle_target_configs(cls, v: Any) -> Any: | ||
"""Handle target configs field aliasing during validation""" | ||
if isinstance(v, dict): | ||
if "schema_" in v: | ||
v["schema"] = v.pop("schema_") | ||
# Handle nested blocks | ||
for value in v.values(): | ||
if isinstance(value, dict) and "schema_" in value: | ||
value["schema"] = value.pop("schema_") | ||
return v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This validator feels like it should be on BaseTargetConfigs
instead. I think you wouldn't have to worry about nested blocks in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@desertaxle i mentioned this here, maybe it should be a before model_validator
instead of field_validator
? bc the alias schema_
presents an issue with the field_validator
I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity, @zzstoatzz and I looked at this quite thoroughly, and it seems like we are inconsistent in our use of aliases when dumping Blocks. We agreed that the current validator approach is a good short term option and we'll work on adding additional validation aliases to schema_
fields to ensure we handle the inconsistency in Block dumping.
2fae812
to
58c426e
Compare
This introduces
PrefectDbtSettings
, which automatically detects a common set ofDBT_
-prefixed env vars upon instantiation. Intended for use withPrefectDbtRunner
.Checklist
<link to issue>
"mint.json
.