diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 8c5198a..0ffbbbb 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -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 }} diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 42cd38c..6de6181 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -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: diff --git a/integration_tests/models/plugins/snowflake/people_alias.sql b/integration_tests/models/plugins/snowflake/people_alias.sql new file mode 100644 index 0000000..844fb05 --- /dev/null +++ b/integration_tests/models/plugins/snowflake/people_alias.sql @@ -0,0 +1,4 @@ +SELECT + {{ dbt_utils.star(from=ref('people'), except=['email']) }}, + email as email_alias +FROM {{ ref('people') }} \ No newline at end of file diff --git a/integration_tests/models/plugins/snowflake/snowflake_external.yml b/integration_tests/models/plugins/snowflake/snowflake_external.yml index 4e8c24b..943ce53 100644 --- a/integration_tests/models/plugins/snowflake/snowflake_external.yml +++ b/integration_tests/models/plugins/snowflake/snowflake_external.yml @@ -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') @@ -31,7 +28,6 @@ sources: - first_name - last_name - email - - email_alias - name: people_csv_partitioned external: @@ -155,4 +151,26 @@ sources: tests: *equal-to-the-people columns: - name: id - description: "the unique ID for people" \ No newline at end of file + 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 \ No newline at end of file