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
When using dbt_utils.equal_rowcount, comparing tables with 0 rows causes an error as the function returns null instead of a valid result.
Steps to reproduce
Create two models with 0 rows in each.
Implement a test using dbt_utils.equal_rowcount to compare the two models.
Run the test.
Expected results
The test should return 0 as the row count for both models matches (0 rows in each).
Actual results
The test returns null instead of 0, causing an error.
03:25:12 Finished running 1 test, 2 project hooks in 0 hours 0 minutes and 4.11 seconds (4.11s).
03:25:13
03:25:13 Completed with 1 error and 0 warnings:
03:25:13
03:25:13 None is not of type 'integer'
Failed validating 'type' in schema['properties']['failures']:
{'type': 'integer'}
On instance['failures']:
None
03:25:13
03:25:13 Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1
Screenshots and log output
System information
The contents of your packages.yml file:
package: dbt-labs/dbt_utils
version: 1.1.1
Which database are you using dbt with?
postgres
redshift
bigquery
snowflake
other (specify: ____________)
The output of dbt --version:
Core:
- installed: 1.8.6
- latest: 1.9.1 - Update available!
Your version of dbt-core is out of date!
You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation
Plugins:
- bigquery: 1.8.2 - Update available!
Describe the bug
When using dbt_utils.equal_rowcount, comparing tables with 0 rows causes an error as the function returns null instead of a valid result.
Steps to reproduce
Expected results
The test should return 0 as the row count for both models matches (0 rows in each).
Actual results
The test returns null instead of 0, causing an error.
Screenshots and log output
System information
The contents of your
packages.yml
file:version: 1.1.1
Which database are you using dbt with?
The output of
dbt --version
:Additional context
dbt-utils/macros/generic_tests/equal_rowcount.sql
Line 8 in 5c9dc0d
Are you interested in contributing the fix?
Sure! I would replace the implementation with something like:
{{ config(fail_calc = 'coalesce(sum(diff_count), 0)') }}
The text was updated successfully, but these errors were encountered: