Skip to content

The compare_and_classify_query_results macro doesn't work on Trino #127

@adam-tokarski

Description

@adam-tokarski

Describe the bug

When trying to use audit_helper.compare_and_classify_query_results on Trino database, it fails with

Unexpected parameters (varchar, bigint) for function count. Expected: count(), count(t) T"

Steps to reproduce

  1. Prepare sql definition using audit_helper.compare_and_classify_query_results
  2. Try to call dbt run on that

Expected results

That it works?

Actual results

Fails during creating a view; view is not created.

Screenshots and log output

Database Error in model my_model (models/audit_my_model.sql)
TrinoUserError(type=USER_ERROR, name=FUNCTION_NOT_FOUND, message="line 232:13: Unexpected parameters (varchar, bigint) for function count. Expected: count(), count(t) T", query_id=20251117_140555_75379_3f6y3)

System information

packages:
  - package: dbt-labs/codegen
    version: 0.13.1
  - package: brooklyn-data/dbt_artifacts
    version: 2.9.3
  - package: dbt-labs/dbt_utils
    version: 1.3.1
  - package: metaplane/dbt_expectations
    version: 0.10.9
  - package: godatadriven/dbt_date
    version: 0.15.0
  - package: dbt-labs/audit_helper
    version: 0.12.2

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: Trino)

The output of dbt --version:
1.9.8

The operating system you're using:
Linux

The output of python --version:
3.11.13

Additional context

https://trino.io/docs/current/functions/aggregate.html#count

Are you interested in contributing the fix?

Sure!

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