-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix required vars check & prefer recent config (#35)
* Update tests * Fix database vars check * Update boolean checks * Update test script * Bump version & clean up
- Loading branch information
1 parent
0379c10
commit 235dfc9
Showing
46 changed files
with
574 additions
and
99 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
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 was deleted.
Oops, something went wrong.
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
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
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,27 @@ | ||
name: 'upstream_prod_integration_tests' | ||
version: '1.0.0' | ||
config-version: 2 | ||
|
||
profile: 'upstream_prod_db' | ||
|
||
model-paths: ["models"] | ||
test-paths: ["tests"] | ||
macro-paths: ["macros"] | ||
|
||
target-path: "target" # directory which will store compiled SQL files | ||
clean-targets: # directories to be removed by `dbt clean` | ||
- "target" | ||
- "dbt_packages" | ||
|
||
|
||
models: | ||
upstream_prod_integration_tests: | ||
marts: | ||
+schema: marts | ||
staging: | ||
+schema: stg | ||
|
||
vars: | ||
upstream_prod_database_replace: [dev, prod] | ||
upstream_prod_fallback: true | ||
upstream_prod_prefer_recent: true |
10 changes: 10 additions & 0 deletions
10
integration_tests/dev_db_replace/macros/create_test_db.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,10 @@ | ||
{% macro create_test_db(db) -%} | ||
|
||
{% if target.type == "snowflake" %} | ||
{% do run_query("create or replace database " ~ db) %} | ||
{% elif target.type == "databricks" %} | ||
{% do run_query("drop catalog if exists " ~ db ~ " cascade") %} | ||
{% do run_query("create catalog " ~ db) %} | ||
{% endif %} | ||
|
||
{%- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% macro ref( | ||
parent_model, | ||
prod_database=var("upstream_prod_database", None), | ||
prod_schema=var("upstream_prod_schema", None), | ||
enabled=var("upstream_prod_enabled", True), | ||
fallback=var("upstream_prod_fallback", False), | ||
env_schemas=var("upstream_prod_env_schemas", False), | ||
version=None, | ||
prefer_recent=var("upstream_prod_prefer_recent", False), | ||
prod_database_replace=var("upstream_prod_database_replace", None) | ||
) %} | ||
|
||
{% do return(upstream_prod.ref(parent_model, prod_database, prod_schema, enabled, fallback, env_schemas, version)) %} | ||
|
||
{% endmacro %} |
Oops, something went wrong.