-
Notifications
You must be signed in to change notification settings - Fork 46
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 null equality condition to equals macro #744
base: main
Are you sure you want to change the base?
Conversation
…bt-adapters into fix_null_equality_110
…bt-adapters into fix_null_equality_110
…null_equality_condition_to_equals_macro
|
||
{% macro default__equals(expr1, expr2) -%} | ||
{%- if adapter.behavior.enable_truthy_nulls_equals_macro.no_warn %} | ||
case when (({{ expr1 }} = {{ expr2 }}) or ({{ expr1 }} is null and {{ expr2 }} is null)) |
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.
next year we'll enable "extra truthy" nulls and support or ({{ expr1 }}= '' and {{ expr2 }} is null)
body: Added new equals macro that handles null value checks in sql | ||
time: 2024-12-17T11:05:36.363421+02:00 | ||
custom: | ||
Author: adrianburusdbt |
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.
@VersusFacit don't forget to add yourself as an author as well
Also not sure this is "under the hood" as we're making a meaningful improvement to how snapshots/tests work
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.
minor nit on changelog but otherwise LGTM
* TableLastModifiedMetadataBatch capability * pin ddtrace * open connection before calculate_freshness_from_metadata_batch * remove calculate_freshness_from_metadata_batch override * changelog entry * TestGetLastRelationModifiedBatch * restore dev-requirements.txt
resolves #110
followup to #383 #394
Note: still needs the athena test skip fix to be merged into main
Problem
We need to add the capability for the
equals
macro to way the presence of no values. However, this is a huge blast radius and doesn't suit all use cases. So we'd like to add it behind a behavior flag and through customer use of this different behavior determine in the future what would be a better long-term solution while also delivering the customer value we need now. A complete solution will require far more investigation outside of this effort.Solution
The equals macro can be configured at the
dbt_project.yml
level. Special attention is given to bigquery tests in this poor request because turning this flag on or off results in many errors across our current tests. This macro does not play well with sophisticated partitioning. A follow on snowflake PR is coming that will make use of this behavior and test it even more thoroughly.Checklist