-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c41abc
commit 1a8e7dc
Showing
5 changed files
with
109 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM ghcr.io/dbt-labs/dbt-postgres | ||
|
||
RUN chmod -R g+rwX /usr | ||
|
||
COPY . /usr/app/dbt/ | ||
|
||
COPY profiles.yml /usr/app/dbt/.dbt/profiles.yml | ||
|
||
COPY dbt_project.yml /app/dbt_project.yml | ||
|
||
WORKDIR /usr/app/dbt/ | ||
|
||
# dbt is already initiated | ||
|
||
CMD ["--help"] |
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,14 @@ | ||
{% macro generate_schema_name(custom_schema_name, node) -%} | ||
|
||
{%- set default_schema = target.schema -%} | ||
{%- if custom_schema_name is none -%} | ||
|
||
{{ default_schema }} | ||
|
||
{%- else -%} | ||
|
||
{{ custom_schema_name | trim }} | ||
|
||
{%- 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,34 @@ | ||
pmt_dbt: | ||
outputs: | ||
|
||
dev: | ||
type: postgres | ||
threads: 2 | ||
host: theory.bcgov | ||
port: 5443 | ||
user: dlh_admin_user | ||
pass: "{{ env_var('dlh_password') }}" | ||
dbname: lhousedev | ||
schema: public | ||
|
||
test: | ||
type: postgres | ||
threads: 2 | ||
host: theory.bcgov | ||
port: 5444 | ||
user: dlh_admin_user | ||
pass: "{{ env_var('dlh_password') }}" | ||
dbname: lhousetst | ||
schema: public | ||
|
||
prod: | ||
type: postgres | ||
threads: 2 | ||
host: existence.bcgov | ||
port: 5436 | ||
user: dlh_admin_user | ||
pass: "{{ env_var('dlh_password') }}" | ||
dbname: lhouseprd | ||
schema: public | ||
|
||
target: dev |
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,34 @@ | ||
{% snapshot dim_org %} | ||
|
||
{{ | ||
config( | ||
target_schema='pmt_dpl', | ||
strategy='check', | ||
unique_key='pi_hash_key', | ||
check_cols='all', | ||
bind=False, | ||
) | ||
}} | ||
|
||
WITH scd_data AS ( | ||
SELECT | ||
'CORP' as src_sys_code | ||
,org.org_unit_code as org_unit_code | ||
,org.org_unit_name as org_unit_description | ||
,org.rollup_region_code as rollup_region_code | ||
,null as rollup_region_description | ||
,org.rollup_dist_code as rollup_district_code | ||
,null as rollup_district_description | ||
,null as roll_up_area_code | ||
,null as roll_up_area_description, | ||
-- Combine multiple keys into a single composite_key | ||
md5(coalesce(cast('COPR' as varchar),'~') || '|'|| | ||
coalesce(cast(org_unit_code as varchar),'~')) as pi_hash_key | ||
FROM fdw_ods_fta_replication.org_unit org | ||
) | ||
|
||
SELECT * | ||
FROM scd_data | ||
|
||
|
||
{% endsnapshot %} |