-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add postgres dbt model to dbt tests (#2703)
I know there are issues here, but sharing for early review: - Changes the expected test outcome for the view materialization in the existing dbt test from fail to pass - Adds a test confirming that dbt will work with an external postgres database. This uses the actual external demo postgres instance that we mention in our docs, so is probably brittle. Ideally, we would spin something up (Docker?) for the purpose of the test. - Overall, this could also probably use some refactoring, but I _think_ that that will take some pytest magic which may make the tests less legible. --------- Co-authored-by: tycho garen <[email protected]>
- Loading branch information
Showing
6 changed files
with
70 additions
and
15 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
tests/fixtures/dbt_project/models/glaredb_data/postgres_datasource_view_materialization.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,4 @@ | ||
{{ config(materialized='view') }} | ||
|
||
select * | ||
from {{ source('my_pg', 'borough_lookup')}} |
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,7 +1,13 @@ | ||
version: 2 | ||
|
||
sources: | ||
- name: public | ||
- name: basic | ||
schema: public | ||
database: default | ||
tables: | ||
- name: dbt_test | ||
- name: dbt_test | ||
- name: my_pg | ||
schema: public | ||
database: my_pg | ||
tables: | ||
- name: borough_lookup |
2 changes: 1 addition & 1 deletion
2
tests/fixtures/dbt_project/models/glaredb_data/table_materialization.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,4 +1,4 @@ | ||
{{ config(materialized='table') }} | ||
|
||
select * | ||
from {{ source('public', 'dbt_test')}} | ||
from {{ source('basic', 'dbt_test')}} |
2 changes: 1 addition & 1 deletion
2
tests/fixtures/dbt_project/models/glaredb_data/view_materialization.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,4 +1,4 @@ | ||
{{ config(materialized='view') }} | ||
|
||
select * | ||
from {{ source('public', 'dbt_test')}} | ||
from {{ source('basic', 'dbt_test')}} |
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