-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-2461] Support deprecating models #7433
Comments
As discussed at length over in #6736, there are degrees of strictness that we could pursue here. We could choose to be more strict by default:
Our approach so far has been to provide optionality in the primitives and strong guidance in their application. I'm inclined to do the same here, though knowing well that we run the risk of "warning" fatigue. If a deprecation date is approaching, and the model actually needs to stick around - maybe it should be the responsibility of its maintainer to admit defeat, and push back the In this case:
So - I'm good with the proposal outlined above! |
Acceptance Criteria
Parsing:
deprecation_date
as a top-level property (not under config). Other node types (e.g. seeds, snapshots, etc) can not.deprecation_date
is a string - formatted as a date, optionally with a timezone offset (e.g.'2020-10-23+00:00'
or equivalently'2020-10-23'
. Parsed representation ofdeprecation_date
onModelNode
should be a datetime (parsed from one of the two supported formats)deprecation_date
values that are set to a past date (as compared todatetime.now(pytz.utc)
) should raise aDeprecatedModel
warning.ModelNode
objects because we'd need to re-evaluate whether to raiseDeprecatedModel
based on the current time, even when partial parsing. So we'd need to do it once the manifest is loaded (perhaps here: https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/parser/manifest.py#L434)ref
behaviour:datetime.now(pytz.utc)
) -> raise anUpcomingDeprecationReference
warning, containing both the deprecation date and its relative timedatetime.now(pytz.utc)
) -> raise aDeprecatedReference
warningWarning messages:
[WARNING] Model {model_name}[.v{version} if versioned] has passed its deprecation date of {deprecation_date}. This model should be disabled or removed.
[WARNING] While compiling '{this_model_name}': Found a reference to {ref_model_name}[.v{version} if versioned], which is slated for deprecation on '{ref_model_deprecation_date}'. [if versioned: A new version of '{ref_model_name}' is available. Try it out: {{ ref('ref_model_package', 'ref_model_name', v='{ref_model_latest_version}') }}.
[WARNING] While compiling '{this_model_name}': Found a reference to {ref_model_name}[.v{version} if versioned], which was deprecated on '{ref_model_deprecation_date}'. [if versioned: A new version of '{ref_model_name}' is available. Migrate now: {{ ref('ref_model_package', 'ref_model_name', v='{ref_model_latest_version}') }}.
For inspiration:
UnpinnedRefNewVersionAvailable
. I would also be happy if we cleaned up that "info"-level log, perhaps by moving it to an end-of-run summary. We don't have a great way to surface & summarize warnings on the CLI currently—and facilitating this type of cross-team communication is the feature!The text was updated successfully, but these errors were encountered: