Skip to content

[BUG] The test succeeds for non-existing columns. #34

Description

@Siete-F

Is this a new bug in dbt-expectations?

Not sure. I haven't tested it on older versions.

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

Current Behavior

When a column does not exist, the test will simply pass.

11:00:55  8 of 11 START test check_data_type_my_table_non_existing_column__non_existing_type  [RUN]
11:00:56  8 of 11 PASS check_data_type_my_table_non_existing_column__non_existing_type  [PASS in 0.98s]

Expected Behavior

The test to fail.

Steps To Reproduce

Add a test in the dbt schema.yml file like this:

      - name: non_existing_column
        data_tests:
          - dbt_expectations.test_expect_column_values_to_be_of_type: {arguments: {column_type: "non-existing-type"}}

Relevant log output

Environment

- OS: Windows
- Python: 3.10
- dbt: 10.8
- dbt-expectations: 0.10.9

Which database adapter are you using with dbt?

DataBricks, and it works flawlessly otherwise, so I would add it to the 'supported-adapters' :)

Note: dbt-expectations currently does not support database adapters other than the ones listed below.

  • Postgres
  • Snowflake
  • BigQuery

Additional Context

I think it is in this simple logic:

          select
              *
          from
              relation_columns
          where
              relation_column = 'NON_EXISTING_COLUMN'
              and
              relation_column_type not in ('NON-EXISTING-TYPE')

This does not return a row when the column doesn't exist at all.
And it must return a row to fail the test (see not in ('my_type')).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions