Skip to content

Commit

Permalink
Merge pull request #35 from dbt-labs/feat/upgrade-dbt20-utils7
Browse files Browse the repository at this point in the history
Upgrade dbt v0.20, dbt-utils v0.7
  • Loading branch information
jtcohen6 authored Jul 7, 2021
2 parents c6b917c + 16a62ac commit f0f0e4a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
. venv/bin/activate
pip install --upgrade pip setuptools
pip install dbt
pip install --pre dbt
mkdir -p ~/.dbt
cp integration_tests/ci/sample.profiles.yml ~/.dbt/profiles.yml
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Useful macros when performing data audits

# Installation instructions
New to dbt packages? Read more about them [here](https://docs.getdbt.com/docs/building-a-dbt-project/package-management/).
1. Include this package in your `packages.yml` file — check [here](https://hub.getdbt.com/fishtown-analytics/audit_helper/latest/) for the latest version number.
1. Include this package in your `packages.yml` file — check [here](https://hub.getdbt.com/dbt-labs/audit_helper/latest/) for the latest version number.
2. Run `dbt deps` to install the package.

# Macros
## compare_relations ([source](macros/compare_relations.sql))
This macro generates SQL that can be used to do a row-by-row validation of two
relations. It is largely based on the [equality](https://github.com/fishtown-analytics/dbt-utils#equality-source)
relations. It is largely based on the [equality](https://github.com/dbt-labs/dbt-utils#equality-source)
test in dbt-utils. By default, the generated query returns a summary of audit
results, like so:

Expand Down
4 changes: 2 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: 'audit_helper'
version: '1.0'
version: '0.4.0'
config-version: 2

require-dbt-version: ">=0.18.0"
require-dbt-version: ">=0.20.0"

target-path: "target"
clean-targets: ["target", "dbt_modules"]
Expand Down
4 changes: 0 additions & 4 deletions macros/_get_audit_helper_namespaces.sql

This file was deleted.

2 changes: 1 addition & 1 deletion macros/compare_column_values.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro compare_column_values(a_query, b_query, primary_key, column_to_compare) -%}
{{ return(adapter.dispatch('compare_column_values', packages = audit_helper._get_audit_helper_namespaces())(a_query, b_query, primary_key, column_to_compare)) }}
{{ return(adapter.dispatch('compare_column_values', 'audit_helper')(a_query, b_query, primary_key, column_to_compare)) }}
{%- endmacro %}

{% macro default__compare_column_values(a_query, b_query, primary_key, column_to_compare) -%}
Expand Down
2 changes: 1 addition & 1 deletion macros/compare_queries.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro compare_queries(a_query, b_query, primary_key=None) -%}
{{ return(adapter.dispatch('compare_queries', packages = audit_helper._get_audit_helper_namespaces())(a_query, b_query, primary_key)) }}
{{ return(adapter.dispatch('compare_queries', 'audit_helper')(a_query, b_query, primary_key)) }}
{%- endmacro %}

{% macro default__compare_queries(a_query, b_query, primary_key=None) %}
Expand Down
10 changes: 5 additions & 5 deletions macros/compare_relation_columns.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro compare_relation_columns(a_relation, b_relation) %}
{{ return(adapter.dispatch('compare_relation_columns', packages=audit_helper._get_audit_helper_namespaces())(a_relation, b_relation)) }}
{{ return(adapter.dispatch('compare_relation_columns', 'audit_helper')(a_relation, b_relation)) }}
{% endmacro %}

{% macro default__compare_relation_columns(a_relation, b_relation) %}
Expand Down Expand Up @@ -29,13 +29,13 @@ order by coalesce(a_cols.ordinal_position, b_cols.ordinal_position)

{% macro get_columns_in_relation_sql(relation) %}

{{ adapter.dispatch('get_columns_in_relation_sql', packages=audit_helper._get_audit_helper_namespaces())(relation) }}
{{ adapter.dispatch('get_columns_in_relation_sql', 'audit_helper')(relation) }}

{% endmacro %}

{% macro redshift__get_columns_in_relation_sql(relation) %}
{#-
See https://github.com/fishtown-analytics/dbt/blob/23484b18b71010f701b5312f920f04529ceaa6b2/plugins/redshift/dbt/include/redshift/macros/adapters.sql#L71
See https://github.com/dbt-labs/dbt/blob/23484b18b71010f701b5312f920f04529ceaa6b2/plugins/redshift/dbt/include/redshift/macros/adapters.sql#L71
Edited to include ordinal_position
-#}
with bound_views as (
Expand Down Expand Up @@ -108,7 +108,7 @@ order by ordinal_position

{% macro snowflake__get_columns_in_relation_sql(relation) %}
{#-
From: https://github.com/fishtown-analytics/dbt/blob/dev/louisa-may-alcott/plugins/snowflake/dbt/include/snowflake/macros/adapters.sql#L48
From: https://github.com/dbt-labs/dbt/blob/dev/louisa-may-alcott/plugins/snowflake/dbt/include/snowflake/macros/adapters.sql#L48
Edited to include ordinal_position
-#}
select
Expand All @@ -134,7 +134,7 @@ Edited to include ordinal_position

{% macro postgres__get_columns_in_relation_sql(relation) %}
{#-
From: https://github.com/fishtown-analytics/dbt/blob/23484b18b71010f701b5312f920f04529ceaa6b2/plugins/postgres/dbt/include/postgres/macros/adapters.sql#L32
From: https://github.com/dbt-labs/dbt/blob/23484b18b71010f701b5312f920f04529ceaa6b2/plugins/postgres/dbt/include/postgres/macros/adapters.sql#L32
Edited to include ordinal_position
-#}
select
Expand Down
4 changes: 2 additions & 2 deletions packages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- package: fishtown-analytics/dbt_utils
version: [">=0.6.0", "<0.7.0"]
- package: dbt-labs/dbt_utils
version: [">=0.7.0", "<0.8.0"]

0 comments on commit f0f0e4a

Please sign in to comment.