Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] expect_table_aggregation_to_equal_other_table doesn't work with dates #305

Open
2 tasks done
rafael-italiano opened this issue Apr 16, 2024 · 1 comment
Open
2 tasks done

Comments

@rafael-italiano
Copy link

rafael-italiano commented Apr 16, 2024

Is this a new bug in dbt-expectations?

  • 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

Using the expect_table_aggregation_to_equal_other_table test on a DATETIME, TIMESTAMP or DATE column returns the following error. I think this might be specific to BigQuery, because its COALESCE() function doesn't accept different data types and there's an integer literal amidst the test implementation.

Expected Behavior

expect_table_aggregation_to_equal_other_table would compare two different DATETIME types and return PASS if they're the same.

Steps To Reproduce

Setup .yml file as follows:

models:
  - name: table
    tests:
          - dbt_expectations.expect_table_aggregation_to_equal_other_table:
              expression: max(updatedat)
              compare_model: ref('legacy_table')

Relevant log output

Database Error in test Database Error in test dbt_expectations_expect_table_aggregation_to_equal_other_table_ods_contacts_max_UpdatedDate___source_intercom_legacy_contacts___max_updated_date_ (models/intercom/__intercom.yml)
  No matching signature for function COALESCE for argument types: DATETIME, INT64. Supported signature: COALESCE([ANY, ...])

Environment

- OS: ghcr.io/dbt-labs/dbt-bigquery
- Python: 
- dbt: 1.7.11
- dbt-expectations: 0.10.3

Which database adapter are you using with dbt?

BigQuery 1.7.7

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

  • Postgres
  • Snowflake
  • BigQuery

Additional Context

@rafael-italiano
Copy link
Author

rafael-italiano commented Apr 16, 2024

A workaround to fellows out there who are eager to use this feature, use safe_cast and unix_millis to convert dates, datetimes or timestamp to integers and work from there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant