-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lift + shift for cross-db macros (#25)
* Take some educated guesses * Install dbt-core first * Fixing it live * Just keep swimmingg * More macros * Update branch, submodule pointers * Fix packages, install dbt-utils * Try updating pointers * Is it ready * Try pinning pyodbc * Update dbt-utils submodule * Slightly better * Keep going * Cleanup after rebase * Update version requirement
- Loading branch information
Showing
21 changed files
with
242 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ | |
/**/dbt_packages/ | ||
/**/logs/ | ||
/**/env/ | ||
/**/__pycache__/ | ||
test.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: 'spark_utils' | ||
version: '0.3.0' | ||
config-version: 2 | ||
require-dbt-version: [">=1.0.0", "<2.0.0"] | ||
require-dbt-version: [">=1.2.0", "<2.0.0"] | ||
macro-paths: ["macros"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pytest | ||
pyodbc==4.0.32 | ||
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core | ||
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-tests-adapter&subdirectory=tests/adapter | ||
git+https://github.com/dbt-labs/dbt-spark.git#egg=dbt-spark[ODBC] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
select | ||
{{ dbt_utils.date_trunc('day', dbt_utils.current_timestamp()) }} as today |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
macros/dbt_utils/cross_db_utils/deprecated/assert_not_null.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |
2 changes: 1 addition & 1 deletion
2
...os/dbt_utils/cross_db_utils/datatypes.sql → ...s/cross_db_utils/deprecated/datatypes.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{# numeric ------------------------------------------------ #} | ||
|
||
{% macro spark__type_numeric() %} | ||
decimal(28, 6) | ||
{{ return(adapter.dispatch('type_numeric', 'dbt')()) }} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[pytest] | ||
filterwarnings = | ||
ignore:.*'soft_unicode' has been renamed to 'soft_str'*:DeprecationWarning | ||
ignore:unclosed file .*:ResourceWarning | ||
env_files = | ||
test.env | ||
testpaths = | ||
tests/functional |
Oops, something went wrong.