Skip to content

Commit

Permalink
Slightly better
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Jul 22, 2022
1 parent 331ab6c commit 10a0140
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 23 deletions.
2 changes: 2 additions & 0 deletions integration_tests/dbt_utils/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ clean-targets: # directories to be removed by `dbt clean`
- "dbt_modules"

dispatch:
- macro_namespace: dbt
search_order: ['dbt']
- macro_namespace: dbt_utils
search_order:
- spark_utils
Expand Down
3 changes: 0 additions & 3 deletions macros/dbt_utils/cross_db_utils/concat.sql

This file was deleted.

3 changes: 0 additions & 3 deletions macros/dbt_utils/cross_db_utils/dateadd.sql

This file was deleted.

3 changes: 0 additions & 3 deletions macros/dbt_utils/cross_db_utils/datediff.sql

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% macro assert_not_null(function, arg) -%}
{{ return(adapter.dispatch('assert_not_null', 'dbt')(function, arg)) }}
{%- endmacro %}
3 changes: 3 additions & 0 deletions macros/dbt_utils/cross_db_utils/deprecated/concat.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% macro spark__concat(fields) -%}
{{ return(adapter.dispatch('concat', 'dbt')(fields)) }}
{%- endmacro %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{# numeric ------------------------------------------------ #}

{% macro spark__type_numeric() %}
{{ return(dbt.type_numeric()) }}
{{ return(adapter.dispatch('type_numeric', 'dbt')()) }}
{% endmacro %}
6 changes: 6 additions & 0 deletions macros/dbt_utils/cross_db_utils/deprecated/dateadd.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}
-- dispatch here gets very very confusing
-- we just need to hint to dbt that this is a required macro for resolving dbt.spark__datediff()
-- {{ assert_not_null() }}
{{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}
{% endmacro %}
6 changes: 6 additions & 0 deletions macros/dbt_utils/cross_db_utils/deprecated/datediff.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% macro spark__datediff(first_date, second_date, datepart) %}
-- dispatch here gets very very confusing
-- we just need to hint to dbt that this is a required macro for resolving dbt.spark__datediff()
-- {{ assert_not_null() }}
{{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}
{% endmacro %}
3 changes: 3 additions & 0 deletions macros/dbt_utils/cross_db_utils/deprecated/split_part.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% macro spark__split_part(string_text, delimiter_text, part_number) %}
{{ return(adapter.dispatch('split_part', 'dbt')(string_text, delimiter_text, part_number)) }}
{% endmacro %}
3 changes: 0 additions & 3 deletions macros/dbt_utils/cross_db_utils/split_part.sql

This file was deleted.

9 changes: 0 additions & 9 deletions macros/etc/assert_not_null.sql

This file was deleted.

2 changes: 1 addition & 1 deletion tests/functional/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def packages(self):
return {
"packages": [
{"local": os.getcwd()},
{"local": f"{os.getcwd()}/dbt-utils"}
{"git": "https://github.com/dbt-labs/dbt-utils"}
]}

@pytest.fixture(scope="class")
Expand Down

0 comments on commit 10a0140

Please sign in to comment.