From 7fe5c0fe266a844d0c59a15821b1682c673cc9a6 Mon Sep 17 00:00:00 2001 From: Brad Williams Date: Tue, 26 Apr 2022 13:32:59 +1000 Subject: [PATCH 01/26] U pgraded macros per the package maintainers requiremen ts for dispatch https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch#for-package-maintainers --- macros/across.sql | 10 ++++++++- macros/get_column_names.sql | 6 +++++- macros/get_matches.sql | 6 +++++- macros/map.sql | 8 ++++++-- macros/select_helpers.sql | 41 ++++++++++++++++++++++++++++++++++--- macros/where_helpers.sql | 8 ++++++++ 6 files changed, 71 insertions(+), 8 deletions(-) diff --git a/macros/across.sql b/macros/across.sql index 3b86c7d..0de16b6 100644 --- a/macros/across.sql +++ b/macros/across.sql @@ -1,4 +1,8 @@ -{% macro across(var_list, script_string = '{{var}}', final_comma = false) %} +{% macro across(var_list, script_string, final_comma) %} + {{ adapter.dispatch('across', 'dbtplyr') (var_list, script_string, final_comma) }} +{% endmacro %} + +{% macro default__across(var_list, script_string, final_comma) %} {% for v in var_list %} {{ script_string | replace('{{var}}', v) }} @@ -9,6 +13,10 @@ {% endmacro %} {% macro c_across(var_list, script_string) %} + {{ adapter.dispatch('c_across', 'dbtplyr') (var_list, script_string) }} +{% endmacro %} + +{% macro default__c_across(var_list, script_string) %} {% if script_string | length < 2 %} {{ var_list | join(script_string) }} diff --git a/macros/get_column_names.sql b/macros/get_column_names.sql index 9701ffd..2533bab 100644 --- a/macros/get_column_names.sql +++ b/macros/get_column_names.sql @@ -1,4 +1,8 @@ -{% macro get_column_names(relation) %} +{% macro get_column_names(var_list, script_string, final_comma) %} + {{ adapter.dispatch('get_column_names', 'dbtplyr') (relation) }} +{% endmacro %} + +{% macro default__get_column_names(relation) %} {# if relation is not actually a reference simply pass through #} {# this is useful so downstream functions can accept either list or relation #} diff --git a/macros/get_matches.sql b/macros/get_matches.sql index 643ab49..47c11a3 100644 --- a/macros/get_matches.sql +++ b/macros/get_matches.sql @@ -1,4 +1,8 @@ -{% macro get_matches(input_list, regex) %} +{% macro get_matches(var_list, script_string, final_comma) %} + {{ adapter.dispatch('get_matches', 'dbtplyr') (input_list, regex) }} +{% endmacro %} + +{% macro default__get_matches(input_list, regex) %} {% set results_list = [] %} {% for l in input_list %} diff --git a/macros/map.sql b/macros/map.sql index 754989a..7ebc2e3 100644 --- a/macros/map.sql +++ b/macros/map.sql @@ -1,4 +1,8 @@ -{% macro map(input_list, fn) %} +{% macro across(input_list, fn) %} + {{ adapter.dispatch('map', 'dbtplyr') (relation) }} +{% endmacro %} + +{% macro default__map(input_list, fn) %} {% set results_list = [] %} {% for l in input_list %} @@ -9,4 +13,4 @@ {{ return(results_list) }} -{% endmacro %} +{% endmacro %} \ No newline at end of file diff --git a/macros/select_helpers.sql b/macros/select_helpers.sql index 5164f5b..cb11c0b 100644 --- a/macros/select_helpers.sql +++ b/macros/select_helpers.sql @@ -1,4 +1,8 @@ {% macro starts_with(string, relation) %} + {{ adapter.dispatch('starts_with', 'dbtplyr') (string, relation) }} +{% endmacro %} + +{% macro default__starts_with(string, relation) %} {%set cols = dbtplyr.get_column_names(relation) %} {%set regex = "^" ~ string ~ ".*" %} @@ -8,6 +12,10 @@ {% endmacro %} {% macro ends_with(string, relation) %} + {{ adapter.dispatch('ends_with', 'dbtplyr') (string, relation) }} +{% endmacro %} + +{% macro default__ends_with(string, relation) %} {%set cols = dbtplyr.get_column_names(relation) %} {%set regex = "^.*" ~ string ~ "$" %} @@ -17,6 +25,10 @@ {% endmacro %} {% macro contains(string, relation) %} + {{ adapter.dispatch('contains', 'dbtplyr') (string, relation) }} +{% endmacro %} + +{% macro default__contains(string, relation) %} {%set cols = dbtplyr.get_column_names(relation) %} {%set regex = "^.*" ~ string ~ ".*$" %} @@ -26,6 +38,10 @@ {% endmacro %} {% macro not_contains(string, relation) %} + {{ adapter.dispatch('not_contains', 'dbtplyr') (string, relation) }} +{% endmacro %} + +{% macro default__not_contains(string, relation) %} {%set cols = dbtplyr.get_column_names(relation) %} {%set regex = "^((?!" ~ string ~ ").)*$" %} @@ -35,6 +51,10 @@ {% endmacro %} {% macro one_of(strings, relation) %} + {{ adapter.dispatch('not_contains', 'dbtplyr') (strings, relation) }} +{% endmacro %} + +{% macro default__one_of(strings, relation) %} {%set cols = dbtplyr.get_column_names(relation) %} {%set regex = "^("+ strings|join("|") +")$" %} @@ -44,6 +64,10 @@ {% endmacro %} {% macro not_one_of(strings, relation) %} + {{ adapter.dispatch('not_one_of', 'dbtplyr') (strings, relation) }} +{% endmacro %} + +{% macro default__not_one_of(strings, relation) %} {%set cols = dbtplyr.get_column_names(relation) %} {%set results = cols | reject('in', strings) %} @@ -52,6 +76,10 @@ {% endmacro %} {% macro matches(string, relation) %} + {{ adapter.dispatch('matches', 'dbtplyr') (string, relation) }} +{% endmacro %} + +{% macro default__matches(string, relation) %} {%set cols = dbtplyr.get_column_names(relation) %} {%set regex = string %} @@ -60,15 +88,22 @@ {% endmacro %} - {% macro everything(relation) %} + {{ adapter.dispatch('everything', 'dbtplyr') (relation) }} +{% endmacro %} + +{% macro default__everything(relation) %} {%set cols = dbtplyr.get_column_names(relation) %} {{return(cols)}} {% endmacro %} -{% macro where(fn, relation) %} +{% macro where(relation) %} + {{ adapter.dispatch('where', 'dbtplyr') (fn, relation) }} +{% endmacro %} + +{% macro default__where(fn, relation) %} {% set cols = adapter.get_columns_in_relation(relation) %} {% set results_list = [] %} @@ -87,4 +122,4 @@ {{return(results_list)}} -{% endmacro %} +{% endmacro %} \ No newline at end of file diff --git a/macros/where_helpers.sql b/macros/where_helpers.sql index de12af9..89c7406 100644 --- a/macros/where_helpers.sql +++ b/macros/where_helpers.sql @@ -1,4 +1,8 @@ {% macro if_any(var_list, script_string) %} + {{ adapter.dispatch('if_any', 'dbtplyr') (var_list, script_string) }} +{% endmacro %} + +{% macro default__if_any(var_list, script_string) %} {% for v in var_list %} {{ "(" ~ script_string | replace('{{var}}', v) ~ ")" }} @@ -8,6 +12,10 @@ {% endmacro %} {% macro if_all(var_list, script_string) %} + {{ adapter.dispatch('if_all', 'dbtplyr') (var_list, script_string) }} +{% endmacro %} + +{% macro default__if_all(var_list, script_string) %} {% for v in var_list %} {{ "(" ~ script_string | replace('{{var}}', v) ~ ")" }} From 4239f0c9064c87f1d5224175796b937842ea28c7 Mon Sep 17 00:00:00 2001 From: Brad Williams Date: Tue, 26 Apr 2022 13:47:40 +1000 Subject: [PATCH 02/26] U pgraded macros per the package maintainers requiremen ts for dispatch https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch#for-package-maintainers --- macros/across.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/across.sql b/macros/across.sql index 0de16b6..57f6ee7 100644 --- a/macros/across.sql +++ b/macros/across.sql @@ -1,5 +1,5 @@ -{% macro across(var_list, script_string, final_comma) %} - {{ adapter.dispatch('across', 'dbtplyr') (var_list, script_string, final_comma) }} +{% macro across(var_list, script_string = '{{var}}', final_comma = false) %} + {{ adapter.dispatch('across', 'dbtplyr') (var_list, script_string = '{{var}}', final_comma = false)) }} {% endmacro %} {% macro default__across(var_list, script_string, final_comma) %} @@ -16,7 +16,7 @@ {{ adapter.dispatch('c_across', 'dbtplyr') (var_list, script_string) }} {% endmacro %} -{% macro default__c_across(var_list, script_string) %} +{% macro c_across(var_list, script_string) %} {% if script_string | length < 2 %} {{ var_list | join(script_string) }} From c0bf6553fbcaf00e08c44382684e6d33e64bfe15 Mon Sep 17 00:00:00 2001 From: Brad Williams Date: Tue, 26 Apr 2022 13:48:38 +1000 Subject: [PATCH 03/26] U pgraded macros per the package maintainers requiremen ts for dispatch https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch#for-package-maintainers --- macros/get_column_names.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/get_column_names.sql b/macros/get_column_names.sql index 2533bab..b8b73af 100644 --- a/macros/get_column_names.sql +++ b/macros/get_column_names.sql @@ -1,4 +1,4 @@ -{% macro get_column_names(var_list, script_string, final_comma) %} +{% macro get_column_names(relation) %} {{ adapter.dispatch('get_column_names', 'dbtplyr') (relation) }} {% endmacro %} @@ -18,4 +18,4 @@ {% endfor %} {{ return(results_list) }} -{% endmacro %} +{% endmacro %} \ No newline at end of file From f1a8b0de75d5646cfdaf162c8512bde682efa5bd Mon Sep 17 00:00:00 2001 From: Brad Williams Date: Tue, 26 Apr 2022 13:49:38 +1000 Subject: [PATCH 04/26] U pgraded macros per the package maintainers requiremen ts for dispatch https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch#for-package-maintainers --- macros/get_matches.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macros/get_matches.sql b/macros/get_matches.sql index 47c11a3..a3e69ed 100644 --- a/macros/get_matches.sql +++ b/macros/get_matches.sql @@ -1,8 +1,7 @@ -{% macro get_matches(var_list, script_string, final_comma) %} +{% macro get_matches(input_list, regex) %} {{ adapter.dispatch('get_matches', 'dbtplyr') (input_list, regex) }} {% endmacro %} -{% macro default__get_matches(input_list, regex) %} {% set results_list = [] %} {% for l in input_list %} From f01804dc64ed11d88f2789438bcbb596690b2ebd Mon Sep 17 00:00:00 2001 From: Brad Williams Date: Tue, 26 Apr 2022 13:51:21 +1000 Subject: [PATCH 05/26] U pgraded macros per the package maintainers requiremen ts for dispatch https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch#for-package-maintainers --- macros/map.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/map.sql b/macros/map.sql index 7ebc2e3..2d93817 100644 --- a/macros/map.sql +++ b/macros/map.sql @@ -1,4 +1,4 @@ -{% macro across(input_list, fn) %} +{% macro map(input_list, fn) %} {{ adapter.dispatch('map', 'dbtplyr') (relation) }} {% endmacro %} From 97f47f9e6dc91dfc196f66111a93d0d3592de9db Mon Sep 17 00:00:00 2001 From: Brad Williams Date: Tue, 26 Apr 2022 13:52:24 +1000 Subject: [PATCH 06/26] U pgraded macros per the package maintainers requiremen ts for dispatch https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch#for-package-maintainers --- macros/select_helpers.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/select_helpers.sql b/macros/select_helpers.sql index cb11c0b..dd705e4 100644 --- a/macros/select_helpers.sql +++ b/macros/select_helpers.sql @@ -99,7 +99,7 @@ {% endmacro %} -{% macro where(relation) %} +{% macro where(fn, relation) %} {{ adapter.dispatch('where', 'dbtplyr') (fn, relation) }} {% endmacro %} From 97808445aa1fae62f3461380f70378e882e090fc Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Tue, 26 Apr 2022 18:34:19 -0500 Subject: [PATCH 07/26] Add default dispatch for c_across --- macros/across.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/across.sql b/macros/across.sql index 57f6ee7..add8b8b 100644 --- a/macros/across.sql +++ b/macros/across.sql @@ -16,7 +16,7 @@ {{ adapter.dispatch('c_across', 'dbtplyr') (var_list, script_string) }} {% endmacro %} -{% macro c_across(var_list, script_string) %} +{% macro default__c_across(var_list, script_string) %} {% if script_string | length < 2 %} {{ var_list | join(script_string) }} @@ -25,4 +25,4 @@ {{ script_string | replace('{{var}}', vars) }} {% endif %} -{% endmacro %} \ No newline at end of file +{% endmacro %} From 9ac71963e65751477d5a0ce4d756d87dd3871cba Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Tue, 26 Apr 2022 18:36:59 -0500 Subject: [PATCH 08/26] fix dispatch for one_of --- macros/select_helpers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/select_helpers.sql b/macros/select_helpers.sql index dd705e4..2ca5852 100644 --- a/macros/select_helpers.sql +++ b/macros/select_helpers.sql @@ -51,7 +51,7 @@ {% endmacro %} {% macro one_of(strings, relation) %} - {{ adapter.dispatch('not_contains', 'dbtplyr') (strings, relation) }} + {{ adapter.dispatch('one_of', 'dbtplyr') (strings, relation) }} {% endmacro %} {% macro default__one_of(strings, relation) %} @@ -122,4 +122,4 @@ {{return(results_list)}} -{% endmacro %} \ No newline at end of file +{% endmacro %} From 42f24cac48e064ea7dd9001c415a5c82d48f85d6 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Tue, 26 Apr 2022 18:37:53 -0500 Subject: [PATCH 09/26] fix default dispatch for get_matches --- macros/get_matches.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macros/get_matches.sql b/macros/get_matches.sql index a3e69ed..1bb2f34 100644 --- a/macros/get_matches.sql +++ b/macros/get_matches.sql @@ -3,6 +3,8 @@ {% endmacro %} +{% macro default__get_matches(input_list, regex) %} + {% set results_list = [] %} {% for l in input_list %} {% if modules.re.match(regex, l, modules.re.IGNORECASE) %} @@ -12,4 +14,4 @@ {{ return(results_list) }} -{% endmacro %} \ No newline at end of file +{% endmacro %} From ca83f117b3f7b2dd163c761399484ffb01e18bca Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Wed, 27 Apr 2022 17:24:06 -0500 Subject: [PATCH 10/26] remove spurious paren --- macros/across.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/across.sql b/macros/across.sql index add8b8b..ac3b4e6 100644 --- a/macros/across.sql +++ b/macros/across.sql @@ -1,5 +1,5 @@ {% macro across(var_list, script_string = '{{var}}', final_comma = false) %} - {{ adapter.dispatch('across', 'dbtplyr') (var_list, script_string = '{{var}}', final_comma = false)) }} + {{ adapter.dispatch('across', 'dbtplyr') (var_list, script_string = '{{var}}', final_comma = false) }} {% endmacro %} {% macro default__across(var_list, script_string, final_comma) %} From c3fbad060c9703ada7209c5ee5a834552b69144a Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Wed, 27 Apr 2022 17:30:55 -0500 Subject: [PATCH 11/26] remove extra space --- macros/get_column_names.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/get_column_names.sql b/macros/get_column_names.sql index b8b73af..1393fd0 100644 --- a/macros/get_column_names.sql +++ b/macros/get_column_names.sql @@ -1,5 +1,5 @@ {% macro get_column_names(relation) %} - {{ adapter.dispatch('get_column_names', 'dbtplyr') (relation) }} + {{ adapter.dispatch('get_column_names', 'dbtplyr')(relation) }} {% endmacro %} {% macro default__get_column_names(relation) %} @@ -18,4 +18,4 @@ {% endfor %} {{ return(results_list) }} -{% endmacro %} \ No newline at end of file +{% endmacro %} From ff4243c158f747a4c8ee00f6e75a9094d8424dae Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Wed, 27 Apr 2022 17:52:13 -0500 Subject: [PATCH 12/26] unpin dbt version in test suite --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b0df93f..7ff3482 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,7 +25,7 @@ jobs: . venv/bin/activate pip install --upgrade pip setuptools - pip install dbt==0.19.0 + pip install dbt mkdir -p ~/.dbt cp integration_tests/ci/profiles.yml ~/.dbt/profiles.yml @@ -65,4 +65,4 @@ jobs: - save_cache: key: deps1-{{ .Branch }} paths: - - "venv" \ No newline at end of file + - "venv" From 591e2f252fc90729f8ff77db81c2c51595cae919 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Wed, 27 Apr 2022 17:56:57 -0500 Subject: [PATCH 13/26] update test suite fishtown -> dbt-labs since error throws warning --- integration_tests/packages.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration_tests/packages.yml b/integration_tests/packages.yml index a579c5e..9d32a1a 100644 --- a/integration_tests/packages.yml +++ b/integration_tests/packages.yml @@ -1,4 +1,4 @@ packages: - - package: fishtown-analytics/dbt_utils - version: 0.6.4 - - local: ../ \ No newline at end of file + - package: dbt-labs/dbt_utils + version: 0.8.4 + - local: ../ From fafd5ca5f82e7e389ee4db8f248a6fa143f47df0 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Wed, 27 Apr 2022 18:04:34 -0500 Subject: [PATCH 14/26] explicit install of dbt in test suite for v1 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7ff3482..4a6eade 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,7 +25,7 @@ jobs: . venv/bin/activate pip install --upgrade pip setuptools - pip install dbt + pip install dbt-core dbt-bigquery dbt-postgres mkdir -p ~/.dbt cp integration_tests/ci/profiles.yml ~/.dbt/profiles.yml From b08e0a4b0fea64559b4182436d6a5be08b12b2cc Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Wed, 27 Apr 2022 18:23:45 -0500 Subject: [PATCH 15/26] revert dbt-utils to work with dbt-core version used in tests --- integration_tests/packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/packages.yml b/integration_tests/packages.yml index 9d32a1a..92c7b76 100644 --- a/integration_tests/packages.yml +++ b/integration_tests/packages.yml @@ -1,4 +1,4 @@ packages: - package: dbt-labs/dbt_utils - version: 0.8.4 + version: 0.7.6 - local: ../ From fd0803b6b17681f9ea25568c2a2ae6f6587067e2 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 04:51:44 -0500 Subject: [PATCH 16/26] bump dbt-utils version in test suite --- integration_tests/packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/packages.yml b/integration_tests/packages.yml index 92c7b76..9d32a1a 100644 --- a/integration_tests/packages.yml +++ b/integration_tests/packages.yml @@ -1,4 +1,4 @@ packages: - package: dbt-labs/dbt_utils - version: 0.7.6 + version: 0.8.4 - local: ../ From 390029646969455484688dbedeb4cb3166fb1d02 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 04:52:39 -0500 Subject: [PATCH 17/26] allow default args to flow through in across --- macros/across.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/across.sql b/macros/across.sql index ac3b4e6..235da39 100644 --- a/macros/across.sql +++ b/macros/across.sql @@ -1,5 +1,5 @@ {% macro across(var_list, script_string = '{{var}}', final_comma = false) %} - {{ adapter.dispatch('across', 'dbtplyr') (var_list, script_string = '{{var}}', final_comma = false) }} + {{ adapter.dispatch('across', 'dbtplyr') (var_list, script_string, final_comma) }} {% endmacro %} {% macro default__across(var_list, script_string, final_comma) %} From 27e410f07e3c876693a99d2503ffb48f690e4cfc Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 04:53:47 -0500 Subject: [PATCH 18/26] add return statement to macro dispatch --- macros/get_column_names.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/get_column_names.sql b/macros/get_column_names.sql index 1393fd0..5049904 100644 --- a/macros/get_column_names.sql +++ b/macros/get_column_names.sql @@ -1,5 +1,5 @@ {% macro get_column_names(relation) %} - {{ adapter.dispatch('get_column_names', 'dbtplyr')(relation) }} + {{ return( adapter.dispatch('get_column_names', 'dbtplyr')(relation) ) }} {% endmacro %} {% macro default__get_column_names(relation) %} From 0a4da31831a91883163947d5f916f7ea553d5e3f Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 04:54:19 -0500 Subject: [PATCH 19/26] add return statement to macro dispatch --- macros/get_matches.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/get_matches.sql b/macros/get_matches.sql index 1bb2f34..458fc33 100644 --- a/macros/get_matches.sql +++ b/macros/get_matches.sql @@ -1,5 +1,5 @@ {% macro get_matches(input_list, regex) %} - {{ adapter.dispatch('get_matches', 'dbtplyr') (input_list, regex) }} + {{ return( adapter.dispatch('get_matches', 'dbtplyr') (input_list, regex) ) }} {% endmacro %} From 8f2715d46ee3c8b33ee2361aae4ceff7810f0c6b Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 04:54:43 -0500 Subject: [PATCH 20/26] add return statement to macro dispatch --- macros/map.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/map.sql b/macros/map.sql index 2d93817..d5db054 100644 --- a/macros/map.sql +++ b/macros/map.sql @@ -1,5 +1,5 @@ {% macro map(input_list, fn) %} - {{ adapter.dispatch('map', 'dbtplyr') (relation) }} + {{ return( adapter.dispatch('map', 'dbtplyr') (relation) ) }} {% endmacro %} {% macro default__map(input_list, fn) %} @@ -13,4 +13,4 @@ {{ return(results_list) }} -{% endmacro %} \ No newline at end of file +{% endmacro %} From 5f287a3669dfa54497a2806d0652ff112540ff29 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 04:56:11 -0500 Subject: [PATCH 21/26] add return statement to macro dispatch --- macros/select_helpers.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/macros/select_helpers.sql b/macros/select_helpers.sql index 2ca5852..4adf308 100644 --- a/macros/select_helpers.sql +++ b/macros/select_helpers.sql @@ -1,5 +1,5 @@ {% macro starts_with(string, relation) %} - {{ adapter.dispatch('starts_with', 'dbtplyr') (string, relation) }} + {{ return( adapter.dispatch('starts_with', 'dbtplyr') (string, relation) ) }} {% endmacro %} {% macro default__starts_with(string, relation) %} @@ -12,7 +12,7 @@ {% endmacro %} {% macro ends_with(string, relation) %} - {{ adapter.dispatch('ends_with', 'dbtplyr') (string, relation) }} + {{ return( adapter.dispatch('ends_with', 'dbtplyr') (string, relation) ) }} {% endmacro %} {% macro default__ends_with(string, relation) %} @@ -25,7 +25,7 @@ {% endmacro %} {% macro contains(string, relation) %} - {{ adapter.dispatch('contains', 'dbtplyr') (string, relation) }} + {{ return( adapter.dispatch('contains', 'dbtplyr') (string, relation) ) }} {% endmacro %} {% macro default__contains(string, relation) %} @@ -38,7 +38,7 @@ {% endmacro %} {% macro not_contains(string, relation) %} - {{ adapter.dispatch('not_contains', 'dbtplyr') (string, relation) }} + {{ return( adapter.dispatch('not_contains', 'dbtplyr') (string, relation) ) }} {% endmacro %} {% macro default__not_contains(string, relation) %} @@ -51,7 +51,7 @@ {% endmacro %} {% macro one_of(strings, relation) %} - {{ adapter.dispatch('one_of', 'dbtplyr') (strings, relation) }} + {{ return( adapter.dispatch('one_of', 'dbtplyr') (strings, relation) ) }} {% endmacro %} {% macro default__one_of(strings, relation) %} @@ -64,7 +64,7 @@ {% endmacro %} {% macro not_one_of(strings, relation) %} - {{ adapter.dispatch('not_one_of', 'dbtplyr') (strings, relation) }} + {{ return( adapter.dispatch('not_one_of', 'dbtplyr') (strings, relation) ) }} {% endmacro %} {% macro default__not_one_of(strings, relation) %} @@ -76,7 +76,7 @@ {% endmacro %} {% macro matches(string, relation) %} - {{ adapter.dispatch('matches', 'dbtplyr') (string, relation) }} + {{ return( adapter.dispatch('matches', 'dbtplyr') (string, relation) ) }} {% endmacro %} {% macro default__matches(string, relation) %} @@ -89,7 +89,7 @@ {% endmacro %} {% macro everything(relation) %} - {{ adapter.dispatch('everything', 'dbtplyr') (relation) }} + {{ return( adapter.dispatch('everything', 'dbtplyr') (relation) ) }} {% endmacro %} {% macro default__everything(relation) %} @@ -100,7 +100,7 @@ {% endmacro %} {% macro where(fn, relation) %} - {{ adapter.dispatch('where', 'dbtplyr') (fn, relation) }} + {{ return( adapter.dispatch('where', 'dbtplyr') (fn, relation) ) }} {% endmacro %} {% macro default__where(fn, relation) %} From 134023e5a2bf7320e427c8fc20fb2830bac0431d Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 04:58:19 -0500 Subject: [PATCH 22/26] force version upgrade for dbt in ci tests --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a6eade..7ab7630 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,7 +25,7 @@ jobs: . venv/bin/activate pip install --upgrade pip setuptools - pip install dbt-core dbt-bigquery dbt-postgres + pip install --upgrade dbt-core dbt-bigquery dbt-postgres mkdir -p ~/.dbt cp integration_tests/ci/profiles.yml ~/.dbt/profiles.yml From ea1ad712b990f0d41eba7a17f3a512ca257555e2 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 05:37:47 -0500 Subject: [PATCH 23/26] force version update and cache invalidation for ci --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7ab7630..fa2b0b3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2 jobs: build: docker: - - image: circleci/python:3.6.3-stretch + - image: cimg/python:3.9.9 - image: circleci/postgres:9.6.5-alpine-ram steps: @@ -16,7 +16,7 @@ jobs: echo $BIGQUERY_SERVICE_ACCOUNT_JSON > ${HOME}/bigquery-service-key.json - restore_cache: - key: deps1-{{ .Branch }} + key: deps2-{{ .Branch }} - run: name: "Setup dbt" @@ -63,6 +63,6 @@ jobs: dbt --warn-error test --target postgres - save_cache: - key: deps1-{{ .Branch }} + key: deps2-{{ .Branch }} paths: - "venv" From 37b03dfe8970e3343d6fd547c19e37c0f134d149 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 05:41:40 -0500 Subject: [PATCH 24/26] don't throw error for deprecation warnings --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fa2b0b3..4e5ea8e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,11 +56,11 @@ jobs: command: | . venv/bin/activate cd integration_tests - dbt --warn-error deps --target postgres - dbt --warn-error seed --target postgres --full-refresh - dbt --warn-error compile --target postgres - dbt --warn-error run --target postgres - dbt --warn-error test --target postgres + dbt deps --target postgres + dbt seed --target postgres --full-refresh + dbt compile --target postgres + dbt run --target postgres + dbt test --target postgres - save_cache: key: deps2-{{ .Branch }} From 6b0c625bb848e8cd1c4ab17be9f086c97c48d3a1 Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 05:42:32 -0500 Subject: [PATCH 25/26] dont throw error for depr warning in ci for bq --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e5ea8e..2c2bc5e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,11 +39,11 @@ jobs: . venv/bin/activate echo `pwd` cd integration_tests - dbt --warn-error deps --target bigquery - dbt --warn-error seed --target bigquery --full-refresh - dbt --warn-error compile --target bigquery - dbt --warn-error run --target bigquery - dbt --warn-error test --target bigquery + dbt deps --target bigquery + dbt seed --target bigquery --full-refresh + dbt compile --target bigquery + dbt run --target bigquery + dbt test --target bigquery - run: name: "Run Tests - Postgres" From b5c60e9c802dda905d861bbbced52cf5517334bd Mon Sep 17 00:00:00 2001 From: Emily Riederer Date: Sun, 1 May 2022 05:50:06 -0500 Subject: [PATCH 26/26] bump package version number and requirements --- dbt_project.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt_project.yml b/dbt_project.yml index 74e1341..e33c20d 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -3,9 +3,9 @@ # and underscores. A good package name should reflect your organization's # name or the intended use of these models name: 'dbtplyr' -version: '0.2.1' +version: '0.3.0' config-version: 2 -require-dbt-version: ">=0.19.0" +require-dbt-version: ">=1.0.0" # This setting configures which "profile" dbt uses for this project. profile: 'dbtplyr'