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.

Home Page:https://getdbt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] `data-tests` not found when executing in v1.8

nicchristeller opened this issue · comments

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

I run dbt build --select my_snapshot

DBT runs the snapshot, but not the associated data-tests defined on its columns in YML:

version: 2

snapshots:
  - name: my_snapshot
    columns:
      - name: unique_key
        data-tests:
          - unique
      - name: my_column
        data-tests:
          - accepted_values:
              values: ['value']

Sample from output:

1 of 1 START snapshot my_schema.my_snapshot  [RUN]
1 of 1 OK snapshotted

Expected Behavior

I expect DBT to run the associated data tests too.

In fact, if I change the above YML to use tests: instead of data-tests:, the tests are executed (with a warning about deprecation of tests:)

Sample of output with data-tests changed to tests::

[WARNING]: Deprecated functionality
The `tests` config has been renamed to `data_tests`. Please see
https://docs.getdbt.com/docs/build/data-tests#new-data_tests-syntax for more
information.
...
1 of 3 START snapshot my_schema.my_snapshot  [RUN]
1 of 3 OK snapshotted my_schema.my_snapshot  [INSERT 0 0 in 9.62s]
2 of 3 START test accepted_values_...  [RUN]
3 of 3 START test unique_...  [RUN]
2 of 3 PASS accepted_values_...  [PASS in 0.94s]
3 of 3 PASS unique_...  [PASS in 0.94s]

Steps To Reproduce

  1. Run dbt build with some data-tests defined

Relevant log output

No response

Environment

- OS: macOS 12.7.4
- Python: Python 3.12.2
- dbt: 

> pip list | grep dbt
dbt-adapters              1.1.1
dbt-common                1.0.4
dbt-core                  1.8.0
dbt-extractor             0.5.1
dbt-postgres              1.8.0
dbt-semantic-interfaces   0.5.1


### Which database adapter are you using with dbt?

postgres

### Additional Context

`dbt test` also doesn't find the tests

False alarm: was using a hyphen not an underscore...