[x] I believe this is a new bug in dbt-expectations
[x] I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
The run_query operation in expect_row_values_to_have_data_for_every_n_datepart can fail if test_start_date or test_end_date are not specified and the model dbt-expectations is testing hasn't been created yet in the target DB.
In our case, this happens at the dbt compile step in a CI build that validates the dbt project associated with a PR is able to compile.
While I don't expect tests to pass if a model doesn't exist in a DB, I do generally want compile to complete, and this blocks that.
Expected Behavior
dbt compile is able to complete when using expect_row_values_to_have_data_for_every_n_datepart even if dbt build/run hasn't been run on a model yet.
Steps To Reproduce
Create a new model and don't run it.
# models/datamart/expectations_test.sql
{{config(
schema='datamart',
materialized='view',
) }}
select '2023-01-01'::date as foo
union all
select '2023-01-02'::date as foo
union all
select '2023-01-03'::date as foo
union all
select '2023-01-04'::date as foo
union all
select '2023-01-05'::date as foo
Create a expect_row_values_to_have_data_for_every_n_datepart against that new model
I don't have any great suggestions on how to fix this beyond making the date boundary required - being able to use expect_row_values_to_have_data_for_every_n_datepart without a date boundary is a nice feature.
Is this a new bug in dbt-expectations?
Current Behavior
The
run_query
operation inexpect_row_values_to_have_data_for_every_n_datepart
can fail iftest_start_date
ortest_end_date
are not specified and the modeldbt-expectations
is testing hasn't been created yet in the target DB.In our case, this happens at the
dbt compile
step in a CI build that validates the dbt project associated with a PR is able to compile.While I don't expect tests to pass if a model doesn't exist in a DB, I do generally want
compile
to complete, and this blocks that.Expected Behavior
dbt compile
is able to complete when usingexpect_row_values_to_have_data_for_every_n_datepart
even ifdbt build/run
hasn't been run on a model yet.Steps To Reproduce
expect_row_values_to_have_data_for_every_n_datepart
against that new modelEnvironment
Which database adapter are you using with dbt?
Snowflake
Additional Context
I don't have any great suggestions on how to fix this beyond making the date boundary required - being able to use
expect_row_values_to_have_data_for_every_n_datepart
without a date boundary is a nice feature.