-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from fishtown-analytics/reorganize-pkg
reorganize package
- Loading branch information
Showing
55 changed files
with
719 additions
and
1,425 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
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 @@ | ||
{% macro prep_external() %} | ||
{{ return(adapter.dispatch('prep_external', dbt_external_tables._get_dbt_external_tables_namespaces())()) }} | ||
{% endmacro %} | ||
|
||
{% macro default__prep_external() %} | ||
{% do log('No prep necessary, skipping', info = true) %} | ||
{# noop #} | ||
{% endmacro %} |
19 changes: 19 additions & 0 deletions
19
integration_tests/macros/plugins/redshift/prep_external.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,19 @@ | ||
{% macro redshift__prep_external() %} | ||
|
||
{% set external_schema = target.schema ~ '_spectrum' %} | ||
|
||
{% set create_external_schema %} | ||
|
||
create external schema if not exists | ||
{{ external_schema }} | ||
from data catalog | ||
database '{{ external_schema }}' | ||
iam_role '{{ env_var("SPECTRUM_IAM_ROLE", "") }}' | ||
create external database if not exists; | ||
|
||
{% endset %} | ||
|
||
{% do log('Creating external schema ' ~ external_schema, info = true) %} | ||
{% do run_query(create_external_schema) %} | ||
|
||
{% endmacro %} |
16 changes: 16 additions & 0 deletions
16
integration_tests/macros/plugins/snowflake/prep_external.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,16 @@ | ||
{% macro snowflake__prep_external() %} | ||
|
||
{% set external_stage = target.schema ~ '.dbt_external_tables_testing' %} | ||
|
||
{% set create_external_stage %} | ||
|
||
create or replace stage | ||
{{ external_stage }} | ||
url = 's3://dbt-external-tables-testing'; | ||
|
||
{% endset %} | ||
|
||
{% do log('Creating external stage ' ~ external_stage, info = true) %} | ||
{% do run_query(create_external_stage) %} | ||
|
||
{% 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
35 changes: 35 additions & 0 deletions
35
integration_tests/macros/plugins/sqlserver/prep_external.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,35 @@ | ||
{% macro sqlserver__prep_external() %} | ||
|
||
{% set external_data_source = target.schema ~ '.dbt_external_tables_testing' %} | ||
|
||
{% set create_external_data_source %} | ||
IF NOT EXISTS ( SELECT * FROM sys.external_data_sources WHERE name = '{{external_data_source}}' ) | ||
|
||
CREATE EXTERNAL DATA SOURCE [{{external_data_source}}] WITH ( | ||
TYPE = HADOOP, | ||
LOCATION = 'wasbs://[email protected]' | ||
) | ||
{% endset %} | ||
|
||
{% set external_file_format = target.schema ~ '.dbt_external_ff_testing' %} | ||
|
||
{% set create_external_file_format %} | ||
IF NOT EXISTS ( SELECT * FROM sys.external_file_formats WHERE name = '{{external_file_format}}' ) | ||
|
||
CREATE EXTERNAL FILE FORMAT [{{external_file_format}}] | ||
WITH ( | ||
FORMAT_TYPE = DELIMITEDTEXT, | ||
FORMAT_OPTIONS ( | ||
FIELD_TERMINATOR = N',', | ||
FIRST_ROW = 2, | ||
USE_TYPE_DEFAULT = True | ||
) | ||
) | ||
{% endset %} | ||
|
||
{% do log('Creating external data source ' ~ external_data_source, info = true) %} | ||
{% do run_query(create_external_data_source) %} | ||
{% do log('Creating external file format ' ~ external_file_format, info = true) %} | ||
{% do run_query(create_external_file_format) %} | ||
|
||
{% endmacro %} |
Oops, something went wrong.