You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want a similar interface to throw warnings. Preferably, these warnings should fail when the --warn-error flag is used.
My particular use case is to throw warnings for macros in dbt-utils that are being deprecated (see here).
Describe alternatives you've considered
Here's how I currently do it:
{% if execute %}
{{ log("Warning: the `get_tables_by_prefix` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `get_relations_by_prefix` macro instead", info=True) }}
{% endif %}
Note that the warning is wrapped in an execute so that dbt doesn't log this when parsing the project (including macros).
Who will this benefit?
Package maintainers.
The text was updated successfully, but these errors were encountered:
I think the easier path is to export the warn_or_error method (or something similar with maybe a clearer name): https://github.com/fishtown-analytics/dbt/blob/dev/0.15.1/core/dbt/exceptions.py#L740
The big difference between a Deprecation and just calling warn_or_error is that a deprecation warning will only be shown once even if that deprecation is “warned” multiple times. If that’s beneficial for the macro use case then we can figure out how to make it happen. If it’s not necessary then there are other simpler options here too
Describe the feature
Currently, we have a jinja interface to throw a compilation error, exceptions:
I want a similar interface to throw warnings. Preferably, these warnings should fail when the
--warn-error
flag is used.My particular use case is to throw warnings for macros in dbt-utils that are being deprecated (see here).
Describe alternatives you've considered
Here's how I currently do it:
Note that the warning is wrapped in an
execute
so that dbt doesn't log this when parsing the project (including macros).Who will this benefit?
Package maintainers.
The text was updated successfully, but these errors were encountered: