Skip to content

Commit

Permalink
Chnages to DBT models
Browse files Browse the repository at this point in the history
  • Loading branch information
vishreddy01 committed Feb 29, 2024
1 parent d7d6333 commit 0e820ea
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
14 changes: 14 additions & 0 deletions logs/dbt.log
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,17 @@ Happy modeling!
13:46:15.758932 [debug] [MainThread]: Command `dbt init` succeeded at 13:46:15.758932 after 27.32 seconds
13:46:15.758932 [debug] [MainThread]: Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'end', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001813D4B18D0>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001813D570390>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001813D49E050>]}
13:46:15.759950 [debug] [MainThread]: Flushing usage events
14:37:37.560373 [debug] [MainThread]: Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'start', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x00000209754E9610>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x0000020975198310>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x0000020974D97150>]}


============================== 14:37:37.564380 | a5264c3f-486c-42e9-be6b-2ac0a72f5e49 ==============================
14:37:37.564380 [info ] [MainThread]: Running with dbt=1.6.2
14:37:37.564380 [debug] [MainThread]: running dbt with arguments {'printer_width': '80', 'indirect_selection': 'eager', 'write_json': 'True', 'log_cache_events': 'False', 'partial_parse': 'True', 'cache_selected_only': 'False', 'profiles_dir': 'C:\\Users\\VREDDY\\.dbt', 'debug': 'False', 'warn_error': 'None', 'log_path': 'logs', 'version_check': 'True', 'fail_fast': 'False', 'use_colors': 'True', 'use_experimental_parser': 'False', 'no_print': 'None', 'quiet': 'False', 'warn_error_options': 'WarnErrorOptions(include=[], exclude=[])', 'introspect': 'True', 'static_parser': 'True', 'log_format': 'default', 'target_path': 'None', 'invocation_command': 'dbt snapshot --select fact_permits', 'send_anonymous_usage_stats': 'True'}
14:37:37.565373 [error] [MainThread]: Encountered an error:
Runtime Error
No dbt_project.yml found at expected path C:\Users\VREDDY\Softwares\nr-dap-dlh\dbt_project.yml
Verify that each entry within packages.yml (and their transitive dependencies) contains a file named dbt_project.yml

14:37:37.566372 [debug] [MainThread]: Command `dbt snapshot` failed at 14:37:37.566372 after 0.04 seconds
14:37:37.566372 [debug] [MainThread]: Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'end', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x0000020975061610>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x00000209750B5350>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x0000020974D8EF10>]}
14:37:37.566372 [debug] [MainThread]: Flushing usage events
1 change: 1 addition & 0 deletions pmt/dbt/pmt_dbt/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
target/
dbt_packages/
logs/
profiles.yml
3 changes: 1 addition & 2 deletions pmt/dbt/pmt_dbt/snapshots/dal/extract_permits.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
target_schema='pmt_dal',
strategy='check',
unique_key='unqid',
check_cols=['ministry_code','business_area_code','permit_status_code','permit_status_date','permit_issue_date','app_received_date','app_update_dateapp_update_date','app_decision_date','app_issuance_date','app_accepted_date','app_rejected_date','app_adjudication_date','harvest_area_sq_m','harvest_auth_status','map_feature_id','permit_type_code','src_sys_description','ministry_description','business_area_description','authorization_status_description','permit_status_description','org_unit_description','permit_type_description'],
check_cols=['ministry_code','business_area_code','permit_status_code','permit_status_date','permit_issue_date','app_received_date','app_update_date','app_decision_date','app_issuance_date','app_accepted_date','app_rejected_date','app_adjudication_date','harvest_area_sq_m','harvest_auth_status','map_feature_id','permit_type_code','src_sys_description','ministry_description','business_area_description','authorization_status_description','permit_status_description','permit_type_description'],
invalidate_hard_deletes=True,
bind=False,
)
Expand Down Expand Up @@ -105,6 +105,5 @@ with extract_data as (
)
--insert into pmt_dal.extract_permits
Select * from extract_data
;

{% endsnapshot %}
35 changes: 18 additions & 17 deletions pmt/dbt/pmt_dbt/snapshots/dpl/fact_permits.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
target_schema='pmt_dpl',
strategy='check',
unique_key='unqid',
check_cols=['ministry_code','business_area_code','permit_status_code','permit_status_date','permit_issue_date','app_received_date','app_update_date','app_decision_date','app_decision_date','app_issuance_date','app_accepted_date','app_rejected_date','app_adjudication_date','harvest_area_sq_m','harvest_auth_status','map_feature_id','permit_type_code'],
check_cols=['ministry_code','business_area_code','permit_status_code','permit_status_date','permit_issue_date','app_received_date','app_update_date','app_decision_date','app_issuance_date','app_accepted_date','app_rejected_date','app_adjudication_date','harvest_area_sq_m','harvest_auth_status','map_feature_id','permit_type_code'],
invalidate_hard_deletes=True,
bind=False,
)
Expand Down Expand Up @@ -34,31 +34,31 @@ with ats_data as (
END as business_area_code
,ats.authorization_id::varchar as application_id
,null ::varchar as permit_id
,ats.file_number as app_file_id
,ats.file_number as app_file_id
,ats.authorization_status_code as authorization_status_code
,ats.project_id::varchar(20) as project_id
,null as permit_status_code
,null::date as permit_status_date
,null::date as permit_issue_date
,null::date as permit_issue_expire_date
,ats.project_id::varchar(20) as project_id
,null as permit_status_code
,null::date as permit_status_date
,null::date as permit_issue_date
,null::date as permit_issue_expire_date
,ats.application_received_date as app_received_date
,coalesce(ats.fcbc_process_complete_date, ats.adjudication_date,ats.application_accepted_date,ats.application_accepted_date ) as app_update_date
,coalesce(ats.fcbc_process_complete_date, ats.adjudication_date,ats.application_accepted_date,ats.application_accepted_date) as app_update_date
,ats.fcbc_process_complete_date as app_decision_date
,ats.adjudication_date as app_issuance_date
,ats.application_accepted_date as app_accepted_date
,null::date as app_rejected_date
,ats.adjudication_date as app_adjudication_date
,null as harvest_auth_status
,null::int as harvest_area_sq_m
,null as permit_org_unit_code
,null::date as app_rejected_date
,ats.adjudication_date as app_adjudication_date
,null as harvest_auth_status
,null::int as harvest_area_sq_m
,null as permit_org_unit_code
,floor(
CASE
WHEN ats.adjudication_date IS NULL THEN EXTRACT(epoch FROM CURRENT_DATE::timestamp without time zone - ats.application_received_date) / 86400
ELSE EXTRACT(epoch FROM ats.adjudication_date - ats.application_received_date) / 86400
END) AS application_age
,null::bigint as map_feature_id
,ats.authorization_instrument_id::varchar(30) as permit_type_code
,'ATS' || '|'|| coalesce(cast(ats.authorization_id as varchar),'~')||'|'||coalesce(cast(ats.file_number as varchar),'~') as unqid
,null::bigint as map_feature_id
,ats.authorization_instrument_id::varchar(30) as permit_type_code
,'ATS' || '|'|| coalesce(cast(ats.authorization_id as varchar),'~')||'|'||coalesce(cast(ats.project_id as varchar),'~') as unqid
from fdw_ods_ats_replication.ats_authorizations ats
LEFT JOIN fdw_ods_ats_replication.ats_authorization_status_codes aasc
ON(ats.authorization_status_code = aasc.authorization_status_code)
Expand Down Expand Up @@ -512,7 +512,8 @@ UNION ALL
rs.geometry_road_section_guid
FROM fdw_ods_rrs_replication.resource_road_tenure t
JOIN fdw_ods_rrs_replication.road_application ra ON encode(ra.resource_road_tenure_guid, 'hex') = encode(t.resource_road_tenure_guid, 'hex')
JOIN fdw_ods_rrs_replication.road_appl_map_feature mf ON encode(mf.road_application_guid, 'hex') = encode(ra.road_application_guid, 'hex')
JOIN (Select *, row_number()over( partition by encode(road_application_guid, 'hex') order by map_feature_id desc ) rn from fdw_ods_rrs_replication.road_appl_map_feature ) mf
ON (encode(mf.road_application_guid, 'hex') = encode(ra.road_application_guid, 'hex') and mf.rn =1)
JOIN fdw_ods_rrs_replication.road_section rs ON encode(mf.feature_record_guid, 'hex') = encode(rs.road_section_guid, 'hex')
JOIN fdw_ods_rrs_replication.road_feature_class_sdw fc ON encode(mf.road_feature_class_sdw_guid, 'hex') = encode(fc.road_feature_class_sdw_guid, 'hex')
JOIN fdw_ods_rrs_replication.road_org_unit_sdw ou ON encode(ou.road_org_unit_sdw_guid, 'hex') = encode(ra.metadata_org_unit_sdw_guid, 'hex')
Expand Down

0 comments on commit 0e820ea

Please sign in to comment.