dbt-labs / dbt-utils

Utility functions for dbt projects.
https://hub.getdbt.com/dbt-labs/dbt_utils/latest/
Apache License 2.0
1.34k stars 491 forks source link

Mutually exclusive ranges support same start and end dates #927

Closed michelbadetti closed 2 months ago

michelbadetti commented 3 months ago

Describe the bug

Using DBT on BigQuery, mutually exclusive ranges test, the highlited line throws a test error. Although, using date ranges (rather than timestamp ranges) and considering that most DBMS have an inclusive "between" operator for dates, it is a legitimate practice to close a date period on D-day when the next period starts at D+1. image

Steps to reproduce

Using DBT on BigQuery, this configuration block in Yaml file should cover the issue reproduction

image

Expected results

On DBMS inclusive "between" operator for dates, when using date ranges, rather than timestamp ranges, having start date = end date should be allowed. Either using a specific option or by default.

Actual results

Par of the result as of now can be seen in the following picture, where start date = end date. image

System information

The contents of your packages.yml file: packages:

Which database are you using dbt with?

The output of dbt --version:

Core:
  - installed: 1.7.13

Plugins:
  - bigquery: 1.7.7
dbeatty10 commented 2 months ago

Thanks for reaching out @michelbadetti !

Did you try zero_length_range_allowed=True?

Here's one of the examples from the docs:

image
michelbadetti commented 2 months ago

Hello @dbeatty10,

My bad then, I thought i had thouroughly read the documentation !

Thank you for your feedback, it solved my issue as could be expected.

dbeatty10 commented 2 months ago

No worries @michelbadetti, so glad you were able to accomplish your goal 🎉