Skip to content

Commit

Permalink
initial dbt yml for stg and src, as well as initial staging tables fo…
Browse files Browse the repository at this point in the history
…r 2022 nts data
  • Loading branch information
charlie-costanzo committed Sep 20, 2024
1 parent c1f84bc commit d524c45
Show file tree
Hide file tree
Showing 36 changed files with 453 additions and 0 deletions.
42 changes: 42 additions & 0 deletions warehouse/models/staging/ntd_annual_data_tables/2022/_src.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: 2

sources:
- name: external_ntd__annual_reporting
description: Annual data tables for the year 2022, loaded from DOT NTD API https://www.transit.dot.gov/ntd/ntd-data.
database: "{{ env_var('DBT_SOURCE_DATABASE', var('SOURCE_DATABASE')) }}"
schema: external_ntd__annual_reporting
tables:
- name: 2022__stations_and_facilities_by_agency_and_facility_type
- name: 2022__stations_by_mode_and_age
- name: 2022__operating_expenses_by_function
- name: 2022__operating_expenses_by_function_and_agency
- name: 2022__operating_expenses_by_type
- name: 2022__operating_expenses_by_type_and_agency
- name: 2022__vehicles_age_distribution
- name: 2022__vehicles_type_count_by_agency
- name: 2022__service_by_mode_and_time_period
- name: 2022__service_by_mode
- name: 2022__service_by_agency
- name: 2022__track_and_roadway_by_mode
- name: 2022__track_and_roadway_guideway_age_distribution
- name: 2022__track_and_roadway_by_agency
- name: 2022__metrics
- name: 2022__funding_sources_by_expense_type
- name: 2022__funding_sources_directly_generated
- name: 2022__funding_sources_taxes_levied_by_agency
- name: 2022__funding_sources_local
- name: 2022__funding_sources_state
- name: 2022__funding_sources_federal
- name: 2022__maintenance_facilities
- name: 2022__maintenance_facilities_by_agency
- name: 2022__fuel_and_energy
- name: 2022__fuel_and_energy_by_agency
- name: 2022__employees_by_mode_and_employee_type
- name: 2022__employees_by_mode
- name: 2022__employees_by_agency
- name: 2022__capital_expenses_by_capital_use
- name: 2022__capital_expenses_by_mode
- name: 2022__capital_expenses_for_existing_service
- name: 2022__capital_expenses_for_expansion_of_service
- name: 2022__breakdowns
- name: 2022__breakdowns_by_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: 2

models:
- name: stg_ntd_annual_data__2022__stations_and_facilities_by_agency_and_facility_type
- name: stg_ntd_annual_data__2022__stations_by_mode_and_age
- name: stg_ntd_annual_data__2022__operating_expenses_by_function
- name: stg_ntd_annual_data__2022__operating_expenses_by_function_and_agency
- name: stg_ntd_annual_data__2022__operating_expenses_by_type
- name: stg_ntd_annual_data__2022__operating_expenses_by_type_and_agency
- name: stg_ntd_annual_data__2022__vehicles_age_distribution
- name: stg_ntd_annual_data__2022__vehicles_type_count_by_agency
- name: stg_ntd_annual_data__2022__service_by_mode_and_time_period
- name: stg_ntd_annual_data__2022__service_by_mode
- name: stg_ntd_annual_data__2022__service_by_agency
- name: stg_ntd_annual_data__2022__track_and_roadway_by_mode
- name: stg_ntd_annual_data__2022__track_and_roadway_guideway_age_distribution
- name: stg_ntd_annual_data__2022__track_and_roadway_by_agency
- name: stg_ntd_annual_data__2022__metrics
- name: stg_ntd_annual_data__2022__funding_sources_by_expense_type
- name: stg_ntd_annual_data__2022__funding_sources_directly_generated
- name: stg_ntd_annual_data__2022__funding_sources_taxes_levied_by_agency
- name: stg_ntd_annual_data__2022__funding_sources_local
- name: stg_ntd_annual_data__2022__funding_sources_state
- name: stg_ntd_annual_data__2022__funding_sources_federal
- name: stg_ntd_annual_data__2022__maintenance_facilities
- name: stg_ntd_annual_data__2022__maintenance_facilities_by_agency
- name: stg_ntd_annual_data__2022__fuel_and_energy
- name: stg_ntd_annual_data__2022__fuel_and_energy_by_agency
- name: stg_ntd_annual_data__2022__employees_by_mode_and_employee_type
- name: stg_ntd_annual_data__2022__employees_by_mode
- name: stg_ntd_annual_data__2022__employees_by_agency
- name: stg_ntd_annual_data__2022__capital_expenses_by_capital_use
- name: stg_ntd_annual_data__2022__capital_expenses_by_mode
- name: stg_ntd_annual_data__2022__capital_expenses_for_existing_service
- name: stg_ntd_annual_data__2022__capital_expenses_for_expansion_of_service
- name: stg_ntd_annual_data__2022__breakdowns
- name: stg_ntd_annual_data__2022__breakdowns_by_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_breakdowns AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__breakdowns') }}
),

stg_ntd_annual_data_tables__2022__breakdowns AS (
SELECT *
FROM external_2022_breakdowns
)

SELECT * FROM stg_ntd_annual_data_tables__2022__breakdowns
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_breakdowns_by_agency AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__breakdowns_by_agency') }}
),

stg_ntd_annual_data_tables__2022__breakdowns_by_agency AS (
SELECT *
FROM external_2022_breakdowns_by_agency
)

SELECT * FROM stg_ntd_annual_data_tables__2022__breakdowns_by_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_capital_expenses_by_capital_use AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__capital_expenses_by_capital_use') }}
),

stg_ntd_annual_data_tables__2022__capital_expenses_by_capital_use AS (
SELECT *
FROM external_2022_capital_expenses_by_capital_use
)

SELECT * FROM stg_ntd_annual_data_tables__2022__capital_expenses_by_capital_use
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_capital_expenses_by_mode AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__capital_expenses_by_mode') }}
),

stg_ntd_annual_data_tables__2022__capital_expenses_by_mode AS (
SELECT *
FROM external_2022_capital_expenses_by_mode
)

SELECT * FROM stg_ntd_annual_data_tables__2022__capital_expenses_by_mode
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_capital_expenses_for_existing_service AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__capital_expenses_for_existing_service') }}
),

stg_ntd_annual_data_tables__2022__capital_expenses_for_existing_service AS (
SELECT *
FROM external_2022_capital_expenses_for_existing_service
)

SELECT * FROM stg_ntd_annual_data_tables__2022__capital_expenses_for_existing_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_capital_expenses_for_expansion_of_service AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__capital_expenses_for_expansion_of_service') }}
),

stg_ntd_annual_data_tables__2022__capital_expenses_for_expansion_of_service AS (
SELECT *
FROM external_2022_capital_expenses_for_expansion_of_service
)

SELECT * FROM stg_ntd_annual_data_tables__2022__capital_expenses_for_expansion_of_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_employees_by_agency AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__employees_by_agency') }}
),

stg_ntd_annual_data_tables__2022__employees_by_agency AS (
SELECT *
FROM external_2022_employees_by_agency
)

SELECT * FROM stg_ntd_annual_data_tables__2022__employees_by_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_employees_by_mode AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__employees_by_mode') }}
),

stg_ntd_annual_data_tables__2022__employees_by_mode AS (
SELECT *
FROM external_2022_employees_by_mode
)

SELECT * FROM stg_ntd_annual_data_tables__2022__employees_by_mode
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_employees_by_mode_and_employee_type AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__employees_by_mode_and_employee_type') }}
),

stg_ntd_annual_data_tables__2022__employees_by_mode_and_employee_type AS (
SELECT *
FROM external_2022_employees_by_mode_and_employee_type
)

SELECT * FROM stg_ntd_annual_data_tables__2022__employees_by_mode_and_employee_type
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_fuel_and_energy AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__fuel_and_energy') }}
),

stg_ntd_annual_data_tables__2022__fuel_and_energy AS (
SELECT *
FROM external_2022_fuel_and_energy
)

SELECT * FROM stg_ntd_annual_data_tables__2022__fuel_and_energy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_fuel_and_energy_by_agency AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__fuel_and_energy_by_agency') }}
),

stg_ntd_annual_data_tables__2022__fuel_and_energy_by_agency AS (
SELECT *
FROM external_2022_fuel_and_energy_by_agency
)

SELECT * FROM stg_ntd_annual_data_tables__2022__fuel_and_energy_by_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_funding_sources_by_expense_type AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__funding_sources_by_expense_type') }}
),

stg_ntd_annual_data_tables__2022__funding_sources_by_expense_type AS (
SELECT *
FROM external_2022_funding_sources_by_expense_type
)

SELECT * FROM stg_ntd_annual_data_tables__2022__funding_sources_by_expense_type
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_funding_sources_directly_generated AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__funding_sources_directly_generated') }}
),

stg_ntd_annual_data_tables__2022__funding_sources_directly_generated AS (
SELECT *
FROM external_2022_funding_sources_directly_generated
)

SELECT * FROM stg_ntd_annual_data_tables__2022__funding_sources_directly_generated
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_funding_sources_federal AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__funding_sources_federal') }}
),

stg_ntd_annual_data_tables__2022__funding_sources_federal AS (
SELECT *
FROM external_2022_funding_sources_federal
)

SELECT * FROM stg_ntd_annual_data_tables__2022__funding_sources_federal
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_funding_sources_local AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__funding_sources_local') }}
),

stg_ntd_annual_data_tables__2022__funding_sources_local AS (
SELECT *
FROM external_2022_funding_sources_local
)

SELECT * FROM stg_ntd_annual_data_tables__2022__funding_sources_local
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_funding_sources_state AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__funding_sources_state') }}
),

stg_ntd_annual_data_tables__2022__funding_sources_state AS (
SELECT *
FROM external_2022_funding_sources_state
)

SELECT * FROM stg_ntd_annual_data_tables__2022__funding_sources_state
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_funding_sources_taxes_levied_by_agency AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__funding_sources_taxes_levied_by_agency') }}
),

stg_ntd_annual_data_tables__2022__funding_sources_taxes_levied_by_agency AS (
SELECT *
FROM external_2022_funding_sources_taxes_levied_by_agency
)

SELECT * FROM stg_ntd_annual_data_tables__2022__funding_sources_taxes_levied_by_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_maintenance_facilities AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__maintenance_facilities') }}
),

stg_ntd_annual_data_tables__2022__maintenance_facilities AS (
SELECT *
FROM external_2022_maintenance_facilities
)

SELECT * FROM stg_ntd_annual_data_tables__2022__maintenance_facilities
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_maintenance_facilities_by_agency AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__maintenance_facilities_by_agency') }}
),

stg_ntd_annual_data_tables__2022__maintenance_facilities_by_agency AS (
SELECT *
FROM external_2022_maintenance_facilities_by_agency
)

SELECT * FROM stg_ntd_annual_data_tables__2022__maintenance_facilities_by_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_metrics AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__metrics') }}
),

stg_ntd_annual_data_tables__2022__metrics AS (
SELECT *
FROM external_2022_metrics
)

SELECT * FROM stg_ntd_annual_data_tables__2022__metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_operating_expenses_by_function AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__operating_expenses_by_function') }}
),

stg_ntd_annual_data_tables__2022__operating_expenses_by_function AS (
SELECT *
FROM external_2022_operating_expenses_by_function
)

SELECT * FROM stg_ntd_annual_data_tables__2022__operating_expenses_by_function
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_operating_expenses_by_function_and_agency AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__operating_expenses_by_function_and_agency') }}
),

stg_ntd_annual_data_tables__2022__operating_expenses_by_function_and_agency AS (
SELECT *
FROM external_2022_operating_expenses_by_function_and_agency
)

SELECT * FROM stg_ntd_annual_data_tables__2022__operating_expenses_by_function_and_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_operating_expenses_by_type AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__operating_expenses_by_type') }}
),

stg_ntd_annual_data_tables__2022__operating_expenses_by_type AS (
SELECT *
FROM external_2022_operating_expenses_by_type
)

SELECT * FROM stg_ntd_annual_data_tables__2022__operating_expenses_by_type
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_operating_expenses_by_type_and_agency AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__operating_expenses_by_type_and_agency') }}
),

stg_ntd_annual_data_tables__2022__operating_expenses_by_type_and_agency AS (
SELECT *
FROM external_2022_operating_expenses_by_type_and_agency
)

SELECT * FROM stg_ntd_annual_data_tables__2022__operating_expenses_by_type_and_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_service_by_agency AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__service_by_agency') }}
),

stg_ntd_annual_data_tables__2022__service_by_agency AS (
SELECT *
FROM external_2022_service_by_agency
)

SELECT * FROM stg_ntd_annual_data_tables__2022__service_by_agency
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
WITH external_2022_service_by_mode AS (
SELECT *
FROM {{ source('external_ntd__annual_reporting', '2022__service_by_mode') }}
),

stg_ntd_annual_data_tables__2022__service_by_mode AS (
SELECT *
FROM external_2022_service_by_mode
)

SELECT * FROM stg_ntd_annual_data_tables__2022__service_by_mode
Loading

0 comments on commit d524c45

Please sign in to comment.