dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.25k stars 1.53k forks source link

[Bug] DBT unit_tests don't work with empty JSON as expected result #10342

Open yengibar-manasyan-sp opened 1 week ago

yengibar-manasyan-sp commented 1 week ago

Is this a new bug in dbt-core?

Current Behavior

Currently, with DBT 1.8 when I want to expect no result, I can do the following:

expect:
  format: csv 
  rows: |

But with JSON it does not work. E.g.:

    expect:
      rows:
        - {}

Expected Behavior

Support empty JSON as expected result meaning that no new records should be inserted into the model:

    expect:
      rows:
        - {}

Steps To Reproduce

  1. Create an incremental model
  2. Create a unit test that in this (current table) has some data
  3. Mock other tables in the test that has sooner modification date than the latest record in the current table
  4. Expect zero result

Relevant log output

001003 (42000): SQL compilation error:

Environment

- OS:
- Python:
- dbt:

Which database adapter are you using with dbt?

snowflake

Additional Context

No response