-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1677 from cal-itp/dim-organizations-add-columns
feat(airtable): add new columns per request #1674
- Loading branch information
Showing
8 changed files
with
154 additions
and
0 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
37 changes: 37 additions & 0 deletions
37
warehouse/models/mart/transit_database/bridge_organizations_x_funding_programs.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,37 @@ | ||
{{ config(materialized='table') }} | ||
|
||
WITH latest_organizations AS ( | ||
{{ get_latest_dense_rank( | ||
external_table = ref('stg_transit_database__organizations'), | ||
order_by = 'calitp_extracted_at DESC' | ||
) }} | ||
), | ||
|
||
latest_funding_programs AS ( | ||
{{ get_latest_dense_rank( | ||
external_table = ref('stg_transit_database__funding_programs'), | ||
order_by = 'calitp_extracted_at DESC' | ||
) }} | ||
), | ||
|
||
bridge_organizations_x_funding_programs AS ( | ||
{{ transit_database_many_to_many( | ||
table_a = 'latest_organizations', | ||
table_a_key_col = 'key', | ||
table_a_key_col_name = 'organization_key', | ||
table_a_name_col = 'name', | ||
table_a_name_col_name = 'organization_name', | ||
table_a_join_col = 'funding_programs', | ||
table_a_date_col = 'calitp_extracted_at', | ||
table_b = 'latest_funding_programs', | ||
table_b_key_col = 'key', | ||
table_b_key_col_name = 'funding_program_key', | ||
table_b_name_col = 'program', | ||
table_b_name_col_name = 'funding_program', | ||
table_b_join_col = 'organization', | ||
table_b_date_col = 'calitp_extracted_at', | ||
shared_date_name = 'calitp_extracted_at' | ||
) }} | ||
) | ||
|
||
SELECT * FROM bridge_organizations_x_funding_programs |
37 changes: 37 additions & 0 deletions
37
warehouse/models/mart/transit_database/bridge_organizations_x_gtfs_datasets_produced.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,37 @@ | ||
{{ config(materialized='table') }} | ||
|
||
WITH latest_organizations AS ( | ||
{{ get_latest_dense_rank( | ||
external_table = ref('stg_transit_database__organizations'), | ||
order_by = 'calitp_extracted_at DESC' | ||
) }} | ||
), | ||
|
||
latest_gtfs_datasets AS ( | ||
{{ get_latest_dense_rank( | ||
external_table = ref('stg_transit_database__gtfs_datasets'), | ||
order_by = 'calitp_extracted_at DESC' | ||
) }} | ||
), | ||
|
||
bridge_organizations_x_gtfs_datasets_managed AS ( | ||
{{ transit_database_many_to_many( | ||
table_a = 'latest_organizations', | ||
table_a_key_col = 'key', | ||
table_a_key_col_name = 'organization_key', | ||
table_a_name_col = 'name', | ||
table_a_name_col_name = 'organization_name', | ||
table_a_join_col = 'gtfs_datasets_produced', | ||
table_a_date_col = 'calitp_extracted_at', | ||
table_b = 'latest_gtfs_datasets', | ||
table_b_key_col = 'key', | ||
table_b_key_col_name = 'gtfs_dataset_key', | ||
table_b_name_col = 'name', | ||
table_b_name_col_name = 'gtfs_dataset_name', | ||
table_b_join_col = 'dataset_producers', | ||
table_b_date_col = 'calitp_extracted_at', | ||
shared_date_name = 'calitp_extracted_at' | ||
) }} | ||
) | ||
|
||
SELECT * FROM bridge_organizations_x_gtfs_datasets_managed |
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