dbt-audit-helper icon indicating copy to clipboard operation
dbt-audit-helper copied to clipboard

create compare_all_columns macro that can be used in dbt test suite

Open leoebfolsom opened this issue 1 year ago • 0 comments

Describe the feature

I would like to build a macro that can be used repeatedly to create dbt tests that test whether all column values match between two versions of dbt code.

This code should abstract away code that would be used for all such tests.

The idea is that I can run a single dbt test on a single table and say "ok, all those columns match up"; and like any dbt test, a single table is created in the warehouse for inspecting the results. (Writing the results to the log/console is great, but doesn't allow for programmatic/automatic checks.) Importantly, this lets dbt_audit_helper become part of a test suite in our production jobs and PR CI/CD.

Going forward, I would like to allow the test to receive arguments excluding columns that are expected to change, but this will provide useful functionality in the general case, and lead to expected test failures when a PR causes a data change.

Describe alternatives you've considered

  • Writing more verbose testing code
  • Running macros manually to test all columns and inspect results visually

Additional context

I will be building for Snowflake as this is the context in which we work--not sure if there will be db-specific needs.

Who will this benefit?

Anyone who wants to very rigorously test their changes as part of a dbt test suite.

Are you interested in contributing this feature?

Yup!

leoebfolsom avatar Jul 14 '22 16:07 leoebfolsom