dbt-labs / dbt-audit-helper

Useful macros when performing data audits

Home Page:https://hub.getdbt.com/dbt-labs/audit_helper/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No Macro named 'get_columns_in_relation_sql' found

Jagdish2022 opened this issue · comments

Hi There,

We are trying to compare two tables but unfortunately, we are getting below error.

I have sent an email to jtcohen6@gmail.com 7 days ago but still waiting for the issue to be resolved.

Encountered an error:
Compilation Error
In dispatch: No macro named 'get_columns_in_relation_sql' found
Searched for: 'audit_helper.sqlserver__get_columns_in_relation_sql', 'audit_helper.default__get_columns_in_relation_sql'

Hi @Jagdish2022, sorry you haven't gotten a response yet — that's my personal email address. I think you'll have better luck opening an issue in the audit_helper repo, which is where I'll transfer this now.

The issue here is that audit_helper.get_columns_in_relation_sql is only implemented for Postgres, Redshift, Snowflake, and BigQuery. There's no default implementation defined in the package, nor is there an implementation for SQLServer.

For that, you'll want to use a "compatibility" package, tsql-utils: https://github.com/dbt-msft/tsql-utils.

If you install both packages:

# packages.yml
packages:
  - package: dbt-labs/audit_helper
    version: 0.4.0
  - package: dbt-msft/tsql_utils
    version: 0.8.1

And add this config to your project file:

dispatch:
  - macro_namespace: dbt_utils
    search_order: ['tsql_utils', 'dbt_utils']
  - macro_namespace: audit_helper
    search_order: ['tsql_utils', 'audit_helper']

That should work.

Thanks for a quick reply Jeremy,

Do you mean I should add below to my dbt_project.yml file?

dispatch:

  • macro_namespace: dbt_utils
    search_order: ['tsql_utils', 'dbt_utils']
  • macro_namespace: audit_helper
    search_order: ['tsql_utils', 'audit_helper']

Thanks Jeremy,

That worked.