Skip to content

Main #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Main #34

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"files.autoSave": "afterDelay",
"screencastMode.onlyKeyboardShortcuts": true,
"terminal.integrated.fontSize": 18,
"workbench.activityBar.visible": true,
"workbench.colorTheme": "Visual Studio Dark",
"workbench.fontAliasing": "antialiased",
"workbench.statusBar.visible": true
Expand Down
Binary file modified data/nyc_parking_violations.db
Binary file not shown.
Binary file modified data/prod_nyc_parking_violations.db
Binary file not shown.
2 changes: 1 addition & 1 deletion nyc_parking_violations/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.user.yml

target/
dbt_packages/
logs/
1 change: 1 addition & 0 deletions nyc_parking_violations/.user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: 28d57600-49ee-49a8-ae9f-a370c6140edb
7 changes: 4 additions & 3 deletions nyc_parking_violations/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ models:
silver_violation_vehicles:
+materialized: view
gold:
+materialized: table
tests:
+store_failures: true
+materialized: view



Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
SELECT
code AS violation_code,
select
code as violation_code,
definition,
manhattan_96th_st_below,
all_other_areas
FROM
from
parking_violation_codes

58 changes: 36 additions & 22 deletions nyc_parking_violations/models/bronze/bronze_parking_violations.sql
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
SELECT
summons_number,
registration_state,
plate_type,
issue_date,
violation_code,
vehicle_body_type,
vehicle_make,
issuing_agency,
vehicle_expiration_date,
violation_location,
violation_precinct,
issuer_precinct,
issuer_code,
issuer_command,
issuer_squad,
violation_time,
violation_county,
violation_legal_code,
vehicle_color,
select
summons_number,
registration_state,
plate_type,
issue_date,
violation_code,
vehicle_body_type,
vehicle_make,
issuing_agency,
vehicle_expiration_date,
violation_location,
violation_precinct,
issuer_precinct,
issuer_code,
issuer_command,
issuer_squad,
violation_time,
time_first_observed,
violation_county,
violation_in_front_of_or_opposite,
date_first_observed,
law_section,
sub_division,
violation_legal_code,
days_parking_in_effect,
from_hours_in_effect,
to_hours_in_effect,
vehicle_color,
unregistered_vehicle,
vehicle_year,
FROM
parking_violations_2023
meter_number,
feet_from_curb,
no_standing_or_stopping_violation,
hydrant_violation,
double_parking_violation
from
parking_violation_2023
2 changes: 1 addition & 1 deletion nyc_parking_violations/models/docs/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ models:
- name: total_revenue_usd
description: '{{ doc("total_revenue_usd") }}'

- name: gold_vehicles_metrics
- name: gold_vehicle_metrics
description: "Aggregated metrics detailing the number of tickets per vehicle, identified by the plate ID."
columns:
- name: registration_state
Expand Down
1 change: 0 additions & 1 deletion nyc_parking_violations/models/example/first_model.sql

This file was deleted.

4 changes: 0 additions & 4 deletions nyc_parking_violations/models/example/ref_model.sql

This file was deleted.

1 change: 1 addition & 0 deletions nyc_parking_violations/models/first_model.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from parking_violation_codes
4 changes: 4 additions & 0 deletions nyc_parking_violations/models/ref_model.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
select
count(*)
from
{{ref('first_model')}}
14 changes: 6 additions & 8 deletions nyc_parking_violations/profiles.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
nyc_parking_violations:
outputs:
dev:
dev:
type: duckdb
path: '../data/nyc_parking_violations.db'
prod:
type: duckdb
# note that path is slightly different as GitHub actions
# start in the root directory and not in the
# nyc_parking_violations directory
path: './data/prod_nyc_parking_violations.db'
target: dev
prod:
type: duckdb
path: '../data/prod_nyc_parking_violations.db'
target: dev

20 changes: 10 additions & 10 deletions nyc_parking_violations/tests/violation_codes_revenue.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{ config(severity = 'warn') }}
{{config(severity='warn')}}

SELECT
violation_code,
SUM(fee_usd) AS total_revenue_usd
FROM
{{ref('silver_parking_violation_codes')}}
GROUP BY
violation_code
HAVING
NOT(total_revenue_usd >= 1)
select
violation_code,
sum(fee_usd) as total_revenue_usd
from
{{ref('silver_parking_violation_codes')}}
group by
violation_code
having
not(total_revenue_usd>=1)
Loading