Skip to content

not_null_proportion.sql cannot hanlde function in group_by_columns #977

@chaubilly

Description

@chaubilly

Describe the bug

In not_null_proportion macro, when function is used in one of group_by_columns, it fails.

Steps to reproduce

Below is an example model config that will trigger the error. Redshift syntax is used.

  • name: dummy_model
    tests:
    - not_null_proportion:
    at_least: 0.999
    group_by_columns: ["date_trunc('month', dummy_date)::date"]

Expected results

Test should run properly with the provided group_by_columns.

Actual results

Error raised.

09:56:48  Database Error in test not_null_proportion_dummy_model (models\_models.yml)
09:56:48    column "dummy_date" does not exist in validation
09:56:48    compiled Code at target\run\dummy_dbt\models\_models.yml\not_null_proportion_xxx.sql

Screenshots and log output

System information

The contents of your packages.yml file:

Which database are you using dbt with?

  • postgres
  • [v] redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

Core:
  - installed: 1.5.3
  - latest:    1.9.1 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - postgres:  1.5.3 - Update available!
  - redshift:  1.5.5 - Update available!
  - sqlserver: 1.3.1 - Not compatible!

  At least one plugin is out of date or incompatible with dbt-core.
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Additional context

Are you interested in contributing the fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions