-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Model Deprecation #7562
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
Model Deprecation #7562
Changes from 1 commit
7cc1d74
55debbe
9ca7d37
fd88586
7842dca
37c8361
ccd73b0
8277e8c
0637591
d9a4cc2
ed443da
e64efb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,11 +539,14 @@ def load(self): | |
| def check_for_model_deprecations(self): | ||
| for node in self.manifest.nodes.values(): | ||
| if isinstance(node, ModelNode): | ||
| if node.deprecation_date and node.deprecation_date < datetime.datetime.now(): | ||
| if ( | ||
| node.deprecation_date | ||
| and node.deprecation_date < datetime.datetime.now().astimezone() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @peterallenwebb want to double-check two things with you:
naive
|
||
| ): | ||
| fire_event( | ||
| DeprecatedModel( | ||
| model_name=node.name, | ||
| model_version=node.version, | ||
| model_version=str(node.version), | ||
MichelleArk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| deprecation_date=node.deprecation_date.isoformat(), | ||
| ) | ||
| ) | ||
|
|
@@ -553,7 +556,7 @@ def check_for_model_deprecations(self): | |
| for resolved_ref in resolved_model_refs: | ||
| if resolved_ref.deprecation_date: | ||
|
|
||
| if resolved_ref.deprecation_date < datetime.datetime.now(): | ||
| if resolved_ref.deprecation_date < datetime.datetime.now().astimezone(): | ||
| event_cls = DeprecatedReference | ||
| else: | ||
| event_cls = UpcomingReferenceDeprecation | ||
|
|
@@ -563,8 +566,8 @@ def check_for_model_deprecations(self): | |
| model_name=node.name, | ||
| ref_model_package=resolved_ref.package_name, | ||
| ref_model_name=resolved_ref.name, | ||
| ref_model_version=resolved_ref.version, | ||
| ref_model_latest_version=resolved_ref.latest_version, | ||
| ref_model_version=str(resolved_ref.version), | ||
| ref_model_latest_version=str(resolved_ref.latest_version), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto here and on the line above re: string conversion and error messages: https://github.com/dbt-labs/dbt-core/pull/7562/files#r1199287517 |
||
| ref_model_deprecation_date=resolved_ref.deprecation_date.isoformat(), | ||
| ) | ||
| ) | ||
|
|
||
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 Python docs here say the following:
Translating those into code gives something like this.
The slight change suggested below would cover the case where
tzinfois notNonebutdt.tzinfo.utcoffset(dt)returnsNone.To fully encode the Python datetime definition, I think we'd need to do something like this:
Granted, it might "never" happen for a
tzinfoobject frompytzto returnNonefor the offset, but I was able to hand construct such atzinfoobject locally.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.
I'd be happy to tighten up this check if you're willing to open the issue. Sorry we didn't get it in v1.