Skip to content

Commit

Permalink
actual test case for #257
Browse files Browse the repository at this point in the history
  • Loading branch information
dataders committed Apr 12, 2024
1 parent a56a255 commit 42ab138
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 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') }}
28 changes: 23 additions & 5 deletions integration_tests/models/plugins/snowflake/snowflake_external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ sources:
data_type: varchar(64)
- name: email
data_type: varchar(64)
- name: email
alias: email_alias
data_type: varchar(64)
tests: &equal-to-the-people
- dbt_utils.equality:
compare_model: ref('people')
Expand All @@ -31,7 +28,6 @@ sources:
- first_name
- last_name
- email
- email_alias

- name: people_csv_partitioned
external:
Expand Down Expand Up @@ -155,4 +151,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 42ab138

Please sign in to comment.