-
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.
Moving to new folder structure and starting updating the config params
- Loading branch information
Vikas Grover
authored and
Vikas Grover
committed
Feb 8, 2024
1 parent
97103a6
commit 914181e
Showing
10 changed files
with
31 additions
and
312 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
{% 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 %} | ||
{% snapshot dim_org %} | ||
|
||
{{ | ||
config( | ||
target_schema='pmt_dpl', | ||
strategy='check', | ||
unique_key='pi_hash_key', | ||
check_cols='all', | ||
invalidate_hard_deletes=True, | ||
bind=False, | ||
) | ||
}} | ||
|
||
with corp_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 | ||
from fdw_ods_fta_replication.org_unit org | ||
) | ||
--insert into pmt_dpl.dim_org | ||
select * | ||
from corp_data | ||
; | ||
|
||
{% endsnapshot %} |