diff --git a/.changes/unreleased/Features-20220309-163817.yaml b/.changes/unreleased/Features-20220309-163817.yaml new file mode 100644 index 00000000000..98e9775f432 --- /dev/null +++ b/.changes/unreleased/Features-20220309-163817.yaml @@ -0,0 +1,8 @@ +kind: Features +body: Change behaviour of `non_null` test so that it only `select`s all columns if + `--store-failures` is enabled. +time: 2022-03-09T16:38:17.160568Z +custom: + Author: willbowditch + Issue: "4769" + PR: "4777" diff --git a/core/dbt/include/global_project/macros/generic_test_sql/not_null.sql b/core/dbt/include/global_project/macros/generic_test_sql/not_null.sql index 52c1ff0b6e4..73e3401f930 100644 --- a/core/dbt/include/global_project/macros/generic_test_sql/not_null.sql +++ b/core/dbt/include/global_project/macros/generic_test_sql/not_null.sql @@ -1,6 +1,8 @@ {% macro default__test_not_null(model, column_name) %} -select * +{% set column_list = '*' if should_store_failures() else column_name %} + +select {{ column_list }} from {{ model }} where {{ column_name }} is null