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

Add function decorator #6413

Closed
wants to merge 34 commits into from
Closed

Add function decorator #6413

wants to merge 34 commits into from

Conversation

emmyoop
Copy link
Member

@emmyoop emmyoop commented Dec 9, 2022

resolves #6393

Description

Add decorator and attach to functions to be removed from exceptions.py as part of #6339

Checklist

@cla-bot cla-bot bot added the cla:yes label Dec 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2022

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@emmyoop emmyoop changed the title Er/ct 1612 decorator Add function decorator Dec 12, 2022
f"This will be removed in version: {self.version}."
)
return line_wrap_message(warning_tag(f"Deprecated functionality\n\n{description}"))

Copy link
Member Author

@emmyoop emmyoop Dec 12, 2022

Choose a reason for hiding this comment

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

This is what the text log line looks like:

17:42:33  [WARNING]: Deprecated functionality

Call to deprecated function raise_compiler_error.
Details of deprecation: Not doing it this way
To resolve this deprecation: raise CompilationException directly.
This will be removed in version 1.5.0.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dbeatty10 can I get your feedback on what information would be useful to get passed as an adapter maintainer? The user won't be able to do anything here but ideally the maintainer can easily fix the deprecated function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for my late reply here @emmyoop !

Here's a variant aiming to be succint and readable:

17:42:33  [WARNING]: `raise_compiler_error` is deprecated and will be removed in dbt-core version 1.5.0

Adapter maintainers can resolve this deprecation by using `raise CompilationException` directly instead.
Lorem ipsum dolor sit amet

Here's where each of the relevant variables would fit in:

17:42:33  [WARNING]: `{self.function_name}` is deprecated and will be removed in dbt-core version {self.version}

Adapter maintainers can resolve this deprecation by {self.suggested_action}.
{self.reason}

@emmyoop emmyoop mentioned this pull request Dec 14, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-1612] Add deprecation decorator for functions
2 participants