- Declare compatibility with dbt v0.21.0, which has no breaking changes for this package (#398)
- Allow user to provide any case type when defining the
exclude
argument indbt_utils.star()
(#403)
dbt v0.20.0 or greater is required for this release. If you are not ready to upgrade, consider using a previous release of this package.
In accordance with the version upgrade, this package release includes breaking changes to:
- Generic (schema) tests
dispatch
functionality
The order of (optional) arguments has changed in the get_column_values
macro.
Before:
{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%}
...
{% endmacro %}
After:
{% macro get_column_values(table, column, max_records=none, default=none) -%}
...
{% endmacro %}
If you were relying on the position to match up your optional arguments, this may be a breaking change — in general, we recommend that you explicitly declare any optional arguments (if not all of your arguments!)
-- before: This works on previous version of dbt-utils, but on 0.7.0, the `50` would be passed through as the `order_by` argument
{% set payment_methods = dbt_utils.get_column_values(
ref('stg_payments'),
'payment_method',
50
) %}
-- after
{% set payment_methods = dbt_utils.get_column_values(
ref('stg_payments'),
'payment_method',
max_records=50
) %}
- Add new argument,
order_by
, toget_column_values
(code originally in #289 from @clausherther, merged via #349) - Add
slugify
macro, and use it in the pivot macro. 🚨 This macro uses there
module, which is only available in dbt v0.19.0+. As a result, this feature introduces a breaking change. (#314) - Add
not_null_proportion
schema test that allows the user to specify the minimum (at_least
) tolerated proportion (e.g.,0.95
) of non-null values
- Update the default implementation of concat macro to use
||
operator (#373 from @ChristopheDuong). Note this may be a breaking change for adapters that supportconcat()
but not||
, such as Apache Spark.
- Use
power()
instead ofpow()
ingenerate_series()
andhaversine_distance()
as they are synonyms in most SQL dialects, but some dialects only havepower()
(#354 from @swanderz)
- make
sequential_values
schema test usedbt_utils.type_timestamp()
to allow for compatibility with db's without timestamp data type. #376 from @swanderz
- Add new
accepted_range
test (#276 @joellabes) - Make
expression_is_true
work as a column test (code originally in #226 from @elliottohara, merged via #313) - Add new schema test,
not_accepted_values
(#284 @JavierMonton) - Support a new argument,
zero_length_range_allowed
in themutually_exclusive_ranges
test (#307 @zemekeneng) - Add new schema test,
sequential_values
(#318, inspired by @hundredwatt) - Support
quarter
in thepostgres__last_day
macro (#333 @seunghanhong) - Add new argument,
unit
, tohaversine_distance
(#340 @bastienboutonnet) - Add new schema test,
fewer_rows_than
(code originally in #221 from @dmarts, merged via #343)
- Handle booleans gracefully in the unpivot macro (#305 @avishalom)
- Fix a bug in
get_relation_by_prefix
that happens with Snowflake external tables. Now the macro will retrieve tables that match the prefix which are external tables (#351) - Fix
cardinality_equality
test when the two tables' column names differed (#334 @joellabes)
- Fix Markdown formatting for hub rendering (#336 @coapacetic)
- Reorder readme and improve docs
- Fix
insert_by_period
to supportdbt v0.19.0
, with backwards compatibility for earlier versions (#319, #320)
- Speed up CI via threads, workflows (#315, #316)
- Fix
equality
test when used with ephemeral models + explicit column set (#321) - Fix
get_query_results_as_dict
integration test with consistent ordering (#322) - All macros are now properly dispatched, making it possible for non-core adapters to implement a shim package for dbt-utils (#312) Thanks @chaerinlee1 and @swanderz
- Small, non-breaking changes to accomodate TSQL (can't group by column number references, no real TRUE/FALSE values, aggregation CTEs need named columns) (#310) Thanks @swanderz
- Make
get_relations_by_pattern
andget_relations_by_prefix
more powerful by returningrelation.type
(#323)
- Fix the logic in
get_tables_by_pattern_sql
to ensure non-default arguments are respected (#279)
- Fix the logic in
get_tables_by_pattern_sql
for matching a schema pattern on BigQuery (#275)
- 🚨 dbt v0.18.0 or greater is required for this release. If you are not ready to upgrade, consider using a previous release of this package
- 🚨 The
get_tables_by_prefix
,union_tables
andget_tables_by_pattern
macros have been removed
- Upgrade your dbt project to v0.18.0 using these instructions.
- Upgrade your
packages.yml
file to use version0.6.0
of this package. Rundbt clean
anddbt deps
. - If your project uses the
get_tables_by_prefix
macro, replace it withget_relations_by_prefix
. All arguments have retained the same name. - If your project uses the
union_tables
macro, replace it withunion_relations
. While the order of arguments has stayed consistent, thetables
argument has been renamed torelations
. Further, the default value for thesource_column_name
argument has changed from'_dbt_source_table'
to'_dbt_source_relation'
— you may want to explicitly define this argument to avoid breaking changes.
-- before:
{{ dbt_utils.union_tables(
tables=[ref('my_model'), source('my_source', 'my_table')],
exclude=["_loaded_at"]
) }}
-- after:
{{ dbt_utils.union_relations(
relations=[ref('my_model'), source('my_source', 'my_table')],
exclude=["_loaded_at"],
source_column_name='_dbt_source_table'
) }}
- If your project uses the
get_tables_by_pattern
macro, replace it withget_tables_by_pattern_sql
— all arguments are consistent.
- Switch usage of
adapter_macro
toadapter.dispatch
, and definedbt_utils_dispatch_list
, enabling users of community-supported database plugins to add or override macro implementations specific to their database (#267) - Use
add_ephemeral_prefix
instead of hard-coding a string literal, to support database adapters that use different prefixes (#267) - Implement a quote_columns argument in the unique_combination_of_columns schema test (#270 @JoshuaHuntley)
- Remove deprecated macros
get_tables_by_prefix
andunion_tables
(#268) - Remove
get_tables_by_pattern
macro, which is equivalent to theget_tables_by_pattern_sql
macro (the latter has a more logical name) (#268)
- Improve release process, and fix tests (#251)
- Make deprecation warnings more useful (#258 @tayloramurphy)
- Add more docs for
date_spine
(#265 @calvingiles)