Skip to content

Commit a8b499b

Browse files
authored
Merge pull request #3 from Shanabunga/custom-schema
Add Logic for Custom Schema
2 parents be96379 + 7e53e37 commit a8b499b

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

dbt_project.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ models:
3434
# Config indicated by + and applies to all files under models/example/
3535
staging:
3636
+materialized: view
37+
+schema: staging

macros/generate_custom_schema.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% macro generate_schema_name(custom_schema_name, node) -%}
2+
3+
{%- set default_schema = target.schema -%}
4+
{%- if target.name == 'prod' -%}
5+
6+
{{ custom_schema_name | trim }}
7+
8+
{%- else -%}
9+
10+
{{ default_schema }}
11+
12+
{%- endif -%}
13+
14+
{%- endmacro %}

0 commit comments

Comments
 (0)