-
Notifications
You must be signed in to change notification settings - Fork 506
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
dbt Core 1.2 and utils 0.9.0 prep #625
Conversation
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.
Super exciting to see all this prepped for the final planned release prior to dbt_utils 1.0! 🚀
The implementation turned out really clean with the reusable xdb_deprecation_warning
macro 🤩
One blocking item:
- @jtcohen6 and I made a decision regarding the
dbt.
namespace prefix, but I'm not sure if it was a local decision only affecting these docs or if it was a more global decision in relation to style. I'd like to get that clarified so the deprecation warning reflects the recommended style one way or the other. Is there anyone responsible for dbt code style?
{% macro xdb_deprecation_warning(macro, package, model) %} | ||
{%- set error_message = "Warning: the `" ~ macro ~"` macro is no longer available in dbt_utils and backwards compatibility will be removed in a future version. Use `dbt." ~ macro ~ "` instead. The " ~ package ~ "." ~ model ~ " model triggered this warning." -%} | ||
{%- do exceptions.warn(error_message) -%} | ||
{% endmacro %} |
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.
@jtcohen6 and I decided here to omit the dbt
namespace for the public-facing documentation for cross-database macros.
I feel the public-facing documentation and the deprecation warning should be in tight alignment; it's confusing for end users when they differ.
There are two different permissible options here (with dbt.
prefix or without). I wonder if this style guide or somewhere else would be good to document our explicit recommendation for which option to use?
{% macro xdb_deprecation_warning(macro, package, model) %} | |
{%- set error_message = "Warning: the `" ~ macro ~"` macro is no longer available in dbt_utils and backwards compatibility will be removed in a future version. Use `dbt." ~ macro ~ "` instead. The " ~ package ~ "." ~ model ~ " model triggered this warning." -%} | |
{%- do exceptions.warn(error_message) -%} | |
{% endmacro %} | |
{% macro xdb_deprecation_warning(macro, package, model) %} | |
{%- set error_message = "Warning: the `" ~ macro ~"` macro is no longer available in dbt_utils and backwards compatibility will be removed in a future version. Drop the `dbt_utils.` prefix and use just `" ~ macro ~ "` instead. The " ~ package ~ "." ~ model ~ " model triggered this warning." -%} | |
{%- do exceptions.warn(error_message) -%} | |
{% endmacro %} |
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 💯 agree with your desire for consistency of advice, especially for the exact same functions.
Ideally that should be true for all macros across the board, which would mean that we should have no dbt.
to be in alignment with other out of the box macros (e.g it would be weird for someone to start going around saying {{ dbt.ref('my_model') }}
.
BUT.
My gut feeling on why these ones are different is that they get a bit uncanny-valley-y. If I am new to dbt, then coming across {{ dateadd() }}
, {{ except() }}
etc could feel quite confusing - do I need to put all SQL keywords into Jinja braces? (In fairness, people shouldn't come across this in their early days, because it should all be deep in the bowels of packages' code.)
If we do {{ dbt.dateadd() }}
, then it's clear that it's behaviour provided by dbt, even though it looks a bunch like standard SQL.
This sort of matches up with something else I've been thinking of, which is the shorthand node selection syntax being the same for a package or a model or a directory (dbt run -s something
). I think we're doing a disservice letting the default advice be "type whatever you want! We'll work it out!" versus the more explicit package:something
, path:something
. But that's a different issue for a different day.
If you or jerco feel very strongly in the opposite direction, I'm willing to be talked around. I just like to know where my magic is coming from 🐰🎩
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.
Jerco and I both considered the two options and decided on the version that is shorter to read and write and aligns with {{ ref() }}
, {{ source() }}
, etc. i.e., without dbt.
prefix.
Since we both had the same preference, we didn't discuss it in detail.
dbt_project.yml
Outdated
name: 'dbt_utils' | ||
version: '0.1.0' | ||
|
||
require-dbt-version: [">=1.0.0", "<2.0.0"] | ||
require-dbt-version: [">=1.2.0-rc1", "<2.0.0"] |
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'm guessing this will drop the -rc1
suffix and flip to just >=1.2.0
prior to the final release of dbt_utils 0.9.0?
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.
Indeed!
- dbt-utils 0.9.0-rc1 supports dbt-core 1.2.0-rc1.
- dbt-utils 0.9.0 will support dbt-core 1.2.0
This is a:
All pull requests from community contributors should target the
main
branch (default).Description & motivation
The cross-db macros have been moved to dbt Core in v1.2. They already were dispatched to the
dbt
project, but now there are also deprecation warnings which will show during compilation. I've also bumped the min dbt version to 1.2-rc1.I think that with these changes, we could release utils 0.9.0-rc1 immediately, and release 0.9.0 final when 1.2 final ships.
Checklist
star()
source)limit_zero()
macro in place of the literal string:limit 0
dbt_utils.type_*
macros instead of explicit datatypes (e.g.dbt_utils.type_timestamp()
instead ofTIMESTAMP