From 74744d3306b1a8b2b2a588f1566bd78135c67bbf Mon Sep 17 00:00:00 2001 From: igor-lobanov-maersk <116725169+igor-lobanov-maersk@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:35:20 +0100 Subject: [PATCH 1/2] Fix for #848 (not_constant fails within groups with 1 element) --- macros/generic_tests/not_constant.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/generic_tests/not_constant.sql b/macros/generic_tests/not_constant.sql index c3a976bf..b8da215c 100644 --- a/macros/generic_tests/not_constant.sql +++ b/macros/generic_tests/not_constant.sql @@ -22,6 +22,6 @@ from {{ model }} {{groupby_gb_cols}} having count(distinct {{ column_name }}) = 1 - + and count(1) > 1 {% endmacro %} From a4bbec1f881c6c3a83eee71b7fa4ce4b518fefa2 Mon Sep 17 00:00:00 2001 From: igor-lobanov-maersk <116725169+igor-lobanov-maersk@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:47:41 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7799278..ea5c466e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ * Improve the performance of the `at_least_one` test by pruning early. This is especially helpful when running against external tables. By @joshuahuntley in https://github.com/dbt-labs/dbt-utils/pull/775 ## Fixes * Fix legacy links in README by @dbeatty10 in https://github.com/dbt-labs/dbt-utils/pull/796 +* Fixed false positive in not_constant test when using groupings and a grouping has only one row by @igor-lobanov-maersk https://github.com/dbt-labs/dbt-utils/issues/848 # dbt utils v1.1.0 ## What's Changed