-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pull new intermediate tables through to mart tables
- Loading branch information
1 parent
743459f
commit 30e0270
Showing
52 changed files
with
1,766 additions
and
980 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...mediate/ntd_funding_and_expenses/int_ntd__capital_expenditures_time_series_facilities.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,60 @@ | ||
{{ config(materialized="table") }} | ||
|
||
WITH | ||
source_pivoted AS ( | ||
{{ | ||
dbt_utils.unpivot( | ||
cast_to="int", | ||
relation=ref("stg_ntd__capital_expenditures_time_series__facilities"), | ||
exclude=[ | ||
"_2023_mode_status", | ||
"agency_name", | ||
"agency_status", | ||
"census_year", | ||
"city", | ||
"last_report_year", | ||
"legacy_ntd_id", | ||
"mode", | ||
"ntd_id", | ||
"reporter_type", | ||
"reporting_module", | ||
"state", | ||
"uace_code", | ||
"uza_area_sq_miles", | ||
"uza_name", | ||
"uza_population", | ||
"dt", | ||
"execution_ts" | ||
], | ||
field_name="year", | ||
value_name="facilities", | ||
) | ||
}} | ||
), | ||
|
||
int_ntd__capital_expenditures_time_series_facilities AS ( | ||
SELECT | ||
agency_name, | ||
agency_status, | ||
census_year, | ||
city, | ||
last_report_year, | ||
legacy_ntd_id, | ||
mode, | ||
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id, | ||
reporter_type, | ||
reporting_module, | ||
state, | ||
uace_code, | ||
uza_area_sq_miles, | ||
uza_name, | ||
uza_population, | ||
split(year, '_')[offset(1)] AS year, | ||
facilities, | ||
_2023_mode_status, | ||
dt, | ||
execution_ts | ||
FROM source_pivoted | ||
) | ||
|
||
SELECT * FROM int_ntd__capital_expenditures_time_series_facilities |
60 changes: 60 additions & 0 deletions
60
...intermediate/ntd_funding_and_expenses/int_ntd__capital_expenditures_time_series_other.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,60 @@ | ||
{{ config(materialized="table") }} | ||
|
||
WITH | ||
source_pivoted AS ( | ||
{{ | ||
dbt_utils.unpivot( | ||
cast_to="int", | ||
relation=ref("stg_ntd__capital_expenditures_time_series__other"), | ||
exclude=[ | ||
"_2023_mode_status", | ||
"agency_name", | ||
"agency_status", | ||
"census_year", | ||
"city", | ||
"last_report_year", | ||
"legacy_ntd_id", | ||
"mode", | ||
"ntd_id", | ||
"reporter_type", | ||
"reporting_module", | ||
"state", | ||
"uace_code", | ||
"uza_area_sq_miles", | ||
"uza_name", | ||
"uza_population", | ||
"dt", | ||
"execution_ts" | ||
], | ||
field_name="year", | ||
value_name="other", | ||
) | ||
}} | ||
), | ||
|
||
int_ntd__capital_expenditures_time_series_other AS ( | ||
SELECT | ||
agency_name, | ||
agency_status, | ||
census_year, | ||
city, | ||
last_report_year, | ||
legacy_ntd_id, | ||
mode, | ||
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id, | ||
reporter_type, | ||
reporting_module, | ||
state, | ||
uace_code, | ||
uza_area_sq_miles, | ||
uza_name, | ||
uza_population, | ||
split(year, '_')[offset(1)] AS year, | ||
other, | ||
_2023_mode_status, | ||
dt, | ||
execution_ts | ||
FROM source_pivoted | ||
) | ||
|
||
SELECT * FROM int_ntd__capital_expenditures_time_series_other |
60 changes: 60 additions & 0 deletions
60
...iate/ntd_funding_and_expenses/int_ntd__capital_expenditures_time_series_rolling_stock.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,60 @@ | ||
{{ config(materialized="table") }} | ||
|
||
WITH | ||
source_pivoted AS ( | ||
{{ | ||
dbt_utils.unpivot( | ||
cast_to="int", | ||
relation=ref("stg_ntd__capital_expenditures_time_series__rolling_stock"), | ||
exclude=[ | ||
"_2023_mode_status", | ||
"agency_name", | ||
"agency_status", | ||
"census_year", | ||
"city", | ||
"last_report_year", | ||
"legacy_ntd_id", | ||
"mode", | ||
"ntd_id", | ||
"reporter_type", | ||
"reporting_module", | ||
"state", | ||
"uace_code", | ||
"uza_area_sq_miles", | ||
"uza_name", | ||
"uza_population", | ||
"dt", | ||
"execution_ts" | ||
], | ||
field_name="year", | ||
value_name="rolling_stock", | ||
) | ||
}} | ||
), | ||
|
||
int_ntd__capital_expenditures_time_series_rolling_stock AS ( | ||
SELECT | ||
agency_name, | ||
agency_status, | ||
census_year, | ||
city, | ||
last_report_year, | ||
legacy_ntd_id, | ||
mode, | ||
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id, | ||
reporter_type, | ||
reporting_module, | ||
state, | ||
uace_code, | ||
uza_area_sq_miles, | ||
uza_name, | ||
uza_population, | ||
split(year, '_')[offset(1)] AS year, | ||
rolling_stock, | ||
_2023_mode_status, | ||
dt, | ||
execution_ts | ||
FROM source_pivoted | ||
) | ||
|
||
SELECT * FROM int_ntd__capital_expenditures_time_series_rolling_stock |
60 changes: 60 additions & 0 deletions
60
...intermediate/ntd_funding_and_expenses/int_ntd__capital_expenditures_time_series_total.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,60 @@ | ||
{{ config(materialized="table") }} | ||
|
||
WITH | ||
source_pivoted AS ( | ||
{{ | ||
dbt_utils.unpivot( | ||
cast_to="int", | ||
relation=ref("stg_ntd__capital_expenditures_time_series__total"), | ||
exclude=[ | ||
"_2023_mode_status", | ||
"agency_name", | ||
"agency_status", | ||
"census_year", | ||
"city", | ||
"last_report_year", | ||
"legacy_ntd_id", | ||
"mode", | ||
"ntd_id", | ||
"reporter_type", | ||
"reporting_module", | ||
"state", | ||
"uace_code", | ||
"uza_area_sq_miles", | ||
"uza_name", | ||
"uza_population", | ||
"dt", | ||
"execution_ts" | ||
], | ||
field_name="year", | ||
value_name="total", | ||
) | ||
}} | ||
), | ||
|
||
int_ntd__capital_expenditures_time_series_total AS ( | ||
SELECT | ||
agency_name, | ||
agency_status, | ||
census_year, | ||
city, | ||
last_report_year, | ||
legacy_ntd_id, | ||
mode, | ||
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id, | ||
reporter_type, | ||
reporting_module, | ||
state, | ||
uace_code, | ||
uza_area_sq_miles, | ||
uza_name, | ||
uza_population, | ||
split(year, '_')[offset(1)] AS year, | ||
total, | ||
_2023_mode_status, | ||
dt, | ||
execution_ts | ||
FROM source_pivoted | ||
) | ||
|
||
SELECT * FROM int_ntd__capital_expenditures_time_series_total |
58 changes: 58 additions & 0 deletions
58
...nding_and_expenses/int_ntd__operating_and_capital_funding_time_series_capital_federal.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,58 @@ | ||
{{ config(materialized="table") }} | ||
|
||
WITH | ||
source_pivoted AS ( | ||
{{ | ||
dbt_utils.unpivot( | ||
cast_to="int", | ||
relation=ref("stg_ntd__operating_and_capital_funding_time_series__capital_federal"), | ||
exclude=[ | ||
"_2023_status", | ||
"agency_name", | ||
"agency_status", | ||
"census_year", | ||
"city", | ||
"last_report_year", | ||
"legacy_ntd_id", | ||
"ntd_id", | ||
"reporter_type", | ||
"reporting_module", | ||
"state", | ||
"uace_code", | ||
"uza_area_sq_miles", | ||
"primary_uza_name", | ||
"uza_population", | ||
"dt", | ||
"execution_ts" | ||
], | ||
field_name="year", | ||
value_name="capital_federal", | ||
) | ||
}} | ||
), | ||
|
||
int_ntd__operating_and_capital_funding_time_series_capital_federal AS ( | ||
SELECT | ||
agency_name, | ||
agency_status, | ||
census_year, | ||
city, | ||
last_report_year, | ||
legacy_ntd_id, | ||
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id, | ||
reporter_type, | ||
reporting_module, | ||
state, | ||
uace_code, | ||
uza_area_sq_miles, | ||
primary_uza_name, | ||
uza_population, | ||
split(year, '_')[offset(1)] AS year, | ||
capital_federal, | ||
_2023_status, | ||
dt, | ||
execution_ts | ||
FROM source_pivoted | ||
) | ||
|
||
SELECT * FROM int_ntd__operating_and_capital_funding_time_series_capital_federal |
58 changes: 58 additions & 0 deletions
58
...funding_and_expenses/int_ntd__operating_and_capital_funding_time_series_capital_local.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,58 @@ | ||
{{ config(materialized="table") }} | ||
|
||
WITH | ||
source_pivoted AS ( | ||
{{ | ||
dbt_utils.unpivot( | ||
cast_to="int", | ||
relation=ref("stg_ntd__operating_and_capital_funding_time_series__capital_local"), | ||
exclude=[ | ||
"_2023_status", | ||
"agency_name", | ||
"agency_status", | ||
"census_year", | ||
"city", | ||
"last_report_year", | ||
"legacy_ntd_id", | ||
"ntd_id", | ||
"reporter_type", | ||
"reporting_module", | ||
"state", | ||
"uace_code", | ||
"uza_area_sq_miles", | ||
"primary_uza_name", | ||
"uza_population", | ||
"dt", | ||
"execution_ts" | ||
], | ||
field_name="year", | ||
value_name="capital_local", | ||
) | ||
}} | ||
), | ||
|
||
int_ntd__operating_and_capital_funding_time_series_capital_local AS ( | ||
SELECT | ||
agency_name, | ||
agency_status, | ||
census_year, | ||
city, | ||
last_report_year, | ||
legacy_ntd_id, | ||
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id, | ||
reporter_type, | ||
reporting_module, | ||
state, | ||
uace_code, | ||
uza_area_sq_miles, | ||
primary_uza_name, | ||
uza_population, | ||
split(year, '_')[offset(1)] AS year, | ||
capital_local, | ||
_2023_status, | ||
dt, | ||
execution_ts | ||
FROM source_pivoted | ||
) | ||
|
||
SELECT * FROM int_ntd__operating_and_capital_funding_time_series_capital_local |
Oops, something went wrong.