Skip to content
Open
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
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"editor.cursorBlinking": "solid",
"editor.fontFamily": "ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace",
"editor.fontLigatures": false,
"editor.fontSize": 22,
"editor.fontSize": 12,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.lineNumbers": "on",
Expand All @@ -16,8 +16,7 @@
"explorer.openEditors.visible": 0,
"files.autoSave": "afterDelay",
"screencastMode.onlyKeyboardShortcuts": true,
"terminal.integrated.fontSize": 18,
"workbench.activityBar.visible": true,
"terminal.integrated.fontSize": 12,
"workbench.colorTheme": "Visual Studio Dark",
"workbench.fontAliasing": "antialiased",
"workbench.statusBar.visible": true
Expand Down
6 changes: 1 addition & 5 deletions assets/tutorial_files/models/docs/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ models:
- name: all_other_areas
description: '{{ doc("all_other_areas") }}'

- name: bronze_parking_violations
- name: bronze_parking_violations
description: Raw data related to parking violations in 2023, encompassing various details about each violation.
columns:
- name: summons_number
description: '{{ doc("summons_number") }}'
tests:
- unique
- not_null
- generic_not_null
- name: registration_state
description: '{{ doc("registration_state") }}'
- name: plate_type
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.
Binary file added my_database.duckdb
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: 57e9178d-61d6-4af0-b0a1-75dab50afcea
16 changes: 10 additions & 6 deletions nyc_parking_violations/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'nyc_parking_violations'
version: '1.0.0'
name: "nyc_parking_violations"
version: "1.0.0"
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: 'nyc_parking_violations'
profile: "nyc_parking_violations"

# These configurations specify where dbt should look for different types of files.
# The `model-paths` config, for example, states that models in this project can be
Expand All @@ -19,17 +18,22 @@ seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

clean-targets: # directories to be removed by `dbt clean`
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"


# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models

# In this example config, we tell dbt to build all models in the example/
# directory as views. These settings can be overridden in the individual model
# files using the `{{ config(...) }}` macro.
# models:
# nyc_parking_violations:
# # Config indicated by + and applies to all files under models/example/
# example:
# +materialized: view

models:
nyc_parking_violations:
# Config indicated by + and applies to all files under models/example/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ SELECT
manhattan_96th_st_below,
all_other_areas
FROM
parking_violation_codes
parking_violation_codes
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 @@ -11,7 +11,7 @@ models:
- name: all_other_areas
description: '{{ doc("all_other_areas") }}'

- name: bronze_parking_violations
- name: bronze_parking_violations
description: Raw data related to parking violations in 2023, encompassing various details about each violation.
columns:
- name: summons_number
Expand Down
3 changes: 2 additions & 1 deletion nyc_parking_violations/models/example/first_model.sql
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SELECT * FROM parking_violation_codes
SELECT *
FROM parking_violation_codes
6 changes: 2 additions & 4 deletions nyc_parking_violations/models/example/ref_model.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
SELECT
COUNT(*)
FROM
{{ref('first_model')}}
SELECT count(*)
FROM {{ ref('first_model') }}
17 changes: 7 additions & 10 deletions nyc_parking_violations/profiles.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
nyc_parking_violations:
outputs:
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
dev:
type: duckdb
path: ../data/nyc_parking_violations.db
prod:
type: duckdb
path: ./data/prod_nyc_parking_violations.db
target: dev
9 changes: 4 additions & 5 deletions nyc_parking_violations/tests/generic/generic_not_null.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
-- source: https://docs.getdbt.com/guides/best-practices/writing-custom-generic-tests#generic-tests-with-default-config-values
{% test generic_not_null(model, column_name) %}

select *
from {{ model }}
where {{ column_name }} is null
select *
from {{ model }}
where {{ column_name }} is null

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

SELECT
violation_code,
SUM(fee_usd) AS total_revenue_usd
{{config(severity='warn')}}
SELECT
violation_code,
sum(fee_usd) AS total_revenue_usd
FROM
{{ref('silver_parking_violation_codes')}}
{{ref('silver_parking_violation_codes')}}
GROUP BY
violation_code
violation_code
HAVING
NOT(total_revenue_usd >= 1)
NOT(total_revenue_usd >= 1)
Loading