Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dataders authored Apr 12, 2024
2 parents 547bc7f + 790023d commit 439cf1b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
export DBT_PROFILES_DIR=.
dbt deps --target ${{ matrix.data-platform }}
dbt seed --full-refresh --target ${{ matrix.data-platform }}
dbt run --target ${{ matrix.data-platform }}
dbt run-operation prep_external --target ${{ matrix.data-platform }}
dbt run-operation dbt_external_tables.stage_external_sources --vars 'ext_full_refresh: true' --target ${{ matrix.data-platform }}
dbt run-operation dbt_external_tables.stage_external_sources --target ${{ matrix.data-platform }}
Expand Down
6 changes: 6 additions & 0 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ dispatch:
seeds:
+quote_columns: false

models:
dbt_external_tables_integration_tests:
plugins:
snowflake:
+enabled: "{{ target.type == 'snowflake' }}"

sources:
dbt_external_tables_integration_tests:
plugins:
Expand Down
4 changes: 4 additions & 0 deletions integration_tests/models/plugins/snowflake/people_alias.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT
{{ dbt_utils.star(from=ref('people'), except=['email']) }},
email as email_alias
FROM {{ ref('people') }}
29 changes: 23 additions & 6 deletions integration_tests/models/plugins/snowflake/snowflake_external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@ sources:
quote: true
identifier: email
expression: split_part(value:email::VARCHAR, '@', 2)
- name: email
alias: email_alias
data_type: varchar(64)
tests: &equal-to-the-people
- dbt_utils.equality:
compare_model: ref('people')
compare_columns:
- id
- first_name
- last_name
- email
- email_alias

- name: people_csv_partitioned
external:
Expand Down Expand Up @@ -160,4 +155,26 @@ sources:
tests: *equal-to-the-people
columns:
- name: id
description: "the unique ID for people"
description: "the unique ID for people"

# test for column aliasing
- name: people_csv_aliased
external: *csv-people
columns:
- name: id
data_type: int
- name: first_name
data_type: varchar(64)
- name: last_name
data_type: varchar(64)
- name: email
alias: email_alias
data_type: varchar(64)
tests:
- dbt_utils.equality:
compare_model: ref('people_alias')
compare_columns:
- id
- first_name
- last_name
- email_alias

0 comments on commit 439cf1b

Please sign in to comment.