Skip to content
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

Add GitHub action to check dbt yaml key sort order #578

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
680fc77
Sort cols alphabeticaly
wagnerlmichael Aug 26, 2024
f478967
Add action jand manual exlusion for some columns
wagnerlmichael Aug 27, 2024
0986a51
Add path info in action
wagnerlmichael Aug 27, 2024
5ea64ea
Correct script name
wagnerlmichael Aug 27, 2024
4a75201
Add test
wagnerlmichael Aug 27, 2024
58f5ad1
Remove test
wagnerlmichael Aug 27, 2024
cc5338e
Add only on PR
wagnerlmichael Aug 27, 2024
4fd00f1
Add wrong column to test
wagnerlmichael Aug 27, 2024
3c05ff5
Correct column order
wagnerlmichael Aug 27, 2024
071a60c
Switch order to test again
wagnerlmichael Aug 27, 2024
b5978e3
re order tests
wagnerlmichael Aug 27, 2024
9420524
Sort over half of test and add script
wagnerlmichael Aug 27, 2024
28e0c99
Sort the rest of data tests
wagnerlmichael Aug 28, 2024
d4ecbf7
Add action for sorting test names
wagnerlmichael Aug 28, 2024
28fe366
Change names
wagnerlmichael Aug 28, 2024
a9b2080
Fix indentation
wagnerlmichael Aug 28, 2024
bf1681b
Fix yaml anchor
wagnerlmichael Aug 28, 2024
dbab974
Fix anchor
wagnerlmichael Aug 28, 2024
8649651
Fix lost test header
wagnerlmichael Aug 28, 2024
7984a71
Add incorrect order
wagnerlmichael Aug 28, 2024
2c15997
Add one more incorrect order
wagnerlmichael Aug 28, 2024
b11098f
Add another incorrect sort
wagnerlmichael Aug 28, 2024
40c29ca
Edit scripts to output one line per multiple errors
wagnerlmichael Aug 28, 2024
5029c9e
Remove random zoo value
wagnerlmichael Aug 28, 2024
e913181
Add missing column
wagnerlmichael Aug 28, 2024
c219d56
Implement feedback
wagnerlmichael Sep 3, 2024
877fd0d
Update dbt/seeds/ccao/schema.yml
wagnerlmichael Sep 3, 2024
01112b4
Continue implementing feedback
wagnerlmichael Sep 3, 2024
0ed3fe7
Merge branch '209-add-github-action-to-check-dbt-yaml-key-sort-order'…
wagnerlmichael Sep 3, 2024
347890d
Remove exit calls
wagnerlmichael Sep 3, 2024
406c64c
Try adding another action for docs header sortings
wagnerlmichael Sep 3, 2024
2182535
Edit action description
wagnerlmichael Sep 3, 2024
55fa83b
Combine sort checks and delete uneeded files
wagnerlmichael Sep 4, 2024
a27dca8
Add shared columns sort check
wagnerlmichael Sep 4, 2024
f033054
test incorrect heading
wagnerlmichael Sep 4, 2024
028f8fd
Correct order in shared columns
wagnerlmichael Sep 4, 2024
ff810ea
Sort more entries
wagnerlmichael Sep 4, 2024
d898908
Correct columns
wagnerlmichael Sep 4, 2024
a8f1a8e
Fix shared columns docs
wagnerlmichael Sep 4, 2024
c55a0a4
Fix natural language errors
wagnerlmichael Sep 4, 2024
c59ccf7
Remove sv outlier reasons
wagnerlmichael Sep 4, 2024
a2de89f
Remove commented out code
wagnerlmichael Sep 4, 2024
b73a59b
Add counters for all checks
wagnerlmichael Sep 4, 2024
c5b01f2
Add docstrings
wagnerlmichael Sep 4, 2024
fe2633d
Sort files
wagnerlmichael Sep 5, 2024
2ff4b74
Sort files
wagnerlmichael Sep 5, 2024
8e6c0b2
Sort files
wagnerlmichael Sep 5, 2024
8fffe45
Sort files
wagnerlmichael Sep 5, 2024
2665250
Update .github/workflows/check_sort_dbt_yaml_files.yaml
wagnerlmichael Sep 6, 2024
409a436
Update .github/workflows/check_sort_dbt_yaml_files.yaml
wagnerlmichael Sep 6, 2024
c1ce27d
Update .github/workflows/check_sort_dbt_yaml_files.yaml
wagnerlmichael Sep 6, 2024
aa528c5
Update dbt/scripts/check_sort_dbt_yaml_files.py
wagnerlmichael Sep 6, 2024
e03221f
Update dbt/seeds/ccao/schema.yml
wagnerlmichael Sep 6, 2024
1a34134
Update .github/workflows/check_sort_dbt_yaml_files.yaml
wagnerlmichael Sep 6, 2024
0fb67a9
Update dweldat yaml with feedback
wagnerlmichael Sep 6, 2024
8a6ebb6
Update dbt/scripts/check_sort_dbt_yaml_files.py
wagnerlmichael Sep 6, 2024
8254769
Make more changes to script
wagnerlmichael Sep 6, 2024
730d49b
Attempt to get action working
wagnerlmichael Sep 6, 2024
1631b6d
Try to get action working
wagnerlmichael Sep 6, 2024
4e07be2
test action
wagnerlmichael Sep 6, 2024
9875b44
test action
wagnerlmichael Sep 6, 2024
2f6cbf0
Test action
wagnerlmichael Sep 6, 2024
f27f5b7
Test action
wagnerlmichael Sep 6, 2024
46760c1
Test action
wagnerlmichael Sep 6, 2024
5fd6e1e
Test action
wagnerlmichael Sep 6, 2024
69542ca
Test action
wagnerlmichael Sep 6, 2024
1c532d2
Test action
wagnerlmichael Sep 6, 2024
aee4efb
Test action
wagnerlmichael Sep 6, 2024
ecf2e4a
Test action
wagnerlmichael Sep 6, 2024
259f3b1
Test action
wagnerlmichael Sep 6, 2024
2585219
Add erroneous file changes
wagnerlmichael Sep 6, 2024
8c52f8a
Updated script
wagnerlmichael Sep 6, 2024
60f4485
Update dbt/models/reporting/schema.yml
wagnerlmichael Sep 6, 2024
d60a93c
Correct sorting
wagnerlmichael Sep 6, 2024
dace271
Correct sorting
wagnerlmichael Sep 6, 2024
18ed22b
Add data tests
wagnerlmichael Sep 6, 2024
9d3293c
Sort errors
wagnerlmichael Sep 6, 2024
2c45bac
Merge branch 'master' into 209-add-github-action-to-check-dbt-yaml-ke…
wagnerlmichael Sep 6, 2024
344bac5
Sort data tests
wagnerlmichael Sep 6, 2024
46df3af
Fix test
wagnerlmichael Sep 6, 2024
e7c6802
Remove garbage text
wagnerlmichael Sep 6, 2024
5434fad
Add seek so we dont miss content
wagnerlmichael Sep 10, 2024
886351f
Format
wagnerlmichael Sep 10, 2024
b69e893
Fix indent
wagnerlmichael Sep 11, 2024
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
24 changes: 24 additions & 0 deletions .github/workflows/check_sort_dbt_yaml_files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: check-sort-dbt-yaml-files

on:
pull_request:
branches: [master]
push:
branches: [master]

jobs:
check-sort-dbt-yaml-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Run dbt yaml sort checks
run: python scripts/check_sort_dbt_yaml_files.py
working-directory: ./dbt
74 changes: 37 additions & 37 deletions dbt/models/ccbor/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,14 @@ sources:
columns:
- name: appeal_id
description: Appeal ID. Matches the "Complaint" value on the Board of Review Decision Search
- name: pin
description: '{{ doc("shared_column_pin") }}'
- name: class
description: '{{ doc("shared_column_class") }}'
- name: township_code
description: '{{ doc("shared_column_township_code") }}'
- name: tax_code
description: '{{ doc("shared_column_tax_code") }}'
- name: appeal_trk
description: First part of the Complaint number
- name: appeal_seq
description: Second part of the Complaint number
- name: appeal_trk
description: First part of the Complaint number
- name: appeal_type
description: Appeal type code
- name: appeal_type_desc
description: Appeal type description
- name: assessor_land_value
description: '{{ doc("shared_column_certified_land") }}'
- name: assessor_improvement_value
description: '{{ doc("shared_column_certified_bldg") }}'
- name: assessor_total_value
description: '{{ doc("shared_column_certified_tot") }}'
- name: bor_land_value
description: '{{ doc("shared_column_board_land") }}'
- name: bor_improvement_value
description: '{{ doc("shared_column_board_bldg") }}'
- name: bor_total_value
description: '{{ doc("shared_column_board_tot") }}'
- name: result
description: Board of Review appeal result
- name: change_reason
description: Reason code for change. This is only populated starting with 2015.
- name: change_reason_desc
description: Reason description for change. This is only populated starting with 2015.
- name: no_change_reason
description: Reason code for no change. This is only populated starting with 2015.
- name: no_change_reason_desc
description: Reason description for no change. This is only populated starting with 2015.
- name: appellant
description: Appellant name
- name: appellant_address
Expand All @@ -56,15 +26,45 @@ sources:
description: Appellant state
- name: appellant_zip
description: Appellant zip code
- name: assessor_improvement_value
description: '{{ doc("shared_column_certified_bldg") }}'
- name: assessor_land_value
description: '{{ doc("shared_column_certified_land") }}'
- name: assessor_total_value
description: '{{ doc("shared_column_certified_tot") }}'
- name: attorney_code
description: Attorney code; whether an attorney was used. Values are Individual/Pro Se, Exempt, or Attorney.
- name: attorney_id
description: Attorney ID. This can be used to join to the Attorney list dataset.
- name: attorney_firm_name
description: Attorney firm name
- name: attorney_first_name
description: Attorney first name
- name: attorney_id
description: Attorney ID. This can be used to join to the Attorney list dataset.
- name: attorney_last_name
description: Attorney last name
- name: attorney_firm_name
description: Attorney firm name
- name: bor_improvement_value
description: '{{ doc("shared_column_board_bldg") }}'
- name: bor_land_value
description: '{{ doc("shared_column_board_land") }}'
- name: bor_total_value
description: '{{ doc("shared_column_board_tot") }}'
- name: change_reason
description: Reason code for change. This is only populated starting with 2015.
- name: change_reason_desc
description: Reason description for change. This is only populated starting with 2015.
- name: class
description: '{{ doc("shared_column_class") }}'
- name: no_change_reason
description: Reason code for no change. This is only populated starting with 2015.
- name: no_change_reason_desc
description: Reason description for no change. This is only populated starting with 2015.
- name: pin
description: '{{ doc("shared_column_pin") }}'
- name: result
description: Board of Review appeal result
- name: tax_code
description: '{{ doc("shared_column_tax_code") }}'
- name: taxyr
description: '{{ doc("shared_column_year") }}'
description: '{{ doc("shared_column_year") }}'
- name: township_code
description: '{{ doc("shared_column_township_code") }}'
42 changes: 21 additions & 21 deletions dbt/models/default/schema/default.vw_card_res_char.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ models:
- type_res

columns:
- name: char_air
description: '{{ doc("shared_column_char_air") }}'
- name: char_attic_fnsh
description: '{{ doc("shared_column_char_attic_fnsh") }}'
- name: char_attic_type
description: '{{ doc("shared_column_char_attic_type") }}'
- name: char_bsmt
description: '{{ doc("shared_column_char_bsmt") }}'
- name: char_bsmt_fin
description: '{{ doc("shared_column_char_bsmt_fin") }}'
- name: char_ext_wall
description: '{{ doc("shared_column_char_ext_wall") }}'
- name: card
description: '{{ doc("shared_column_card") }}'
- name: card_proration_rate
Expand All @@ -26,16 +14,28 @@ models:
description: '{{ doc("shared_column_cdu") }}'
- name: char_age
description: '{{ doc("shared_column_char_age") }}'
- name: char_air
description: '{{ doc("shared_column_char_air") }}'
- name: char_apts
description: '{{ doc("shared_column_char_apts") }}'
- name: char_attic_fnsh
description: '{{ doc("shared_column_char_attic_fnsh") }}'
- name: char_attic_type
description: '{{ doc("shared_column_char_attic_type") }}'
- name: char_beds
description: '{{ doc("shared_column_char_beds") }}'
- name: char_bldg_sf
description: '{{ doc("shared_column_char_bldg_sf") }}'
- name: char_bsmt
description: '{{ doc("shared_column_char_bsmt") }}'
- name: char_bsmt_fin
description: '{{ doc("shared_column_char_bsmt_fin") }}'
- name: char_class
description: '{{ doc("shared_column_char_class") }}'
- name: char_cnst_qlty
description: '{{ doc("shared_column_char_cnst_qlty") }}'
- name: char_ext_wall
description: '{{ doc("shared_column_char_ext_wall") }}'
- name: char_fbath
description: '{{ doc("shared_column_char_fbath") }}'
- name: char_frpl
Expand All @@ -48,10 +48,10 @@ models:
description: '{{ doc("shared_column_char_gar_cnst") }}'
- name: char_gar1_size
description: '{{ doc("shared_column_char_gar_size") }}'
- name: char_heat
description: '{{ doc("shared_column_char_heat") }}'
- name: char_hbath
description: '{{ doc("shared_column_char_hbath") }}'
- name: char_heat
description: '{{ doc("shared_column_char_heat") }}'
- name: char_land_sf
description: '{{ doc("shared_column_char_land_sf") }}'
- name: char_ncu
Expand Down Expand Up @@ -84,16 +84,16 @@ models:
description: '{{ doc("shared_column_class") }}'
- name: pin
description: '{{ doc("shared_column_pin") }}'
- name: pin_is_multiland
description: '{{ doc("shared_column_pin_is_multiland") }}'
- name: pin10
description: '{{ doc("shared_column_pin10") }}'
- name: pin_is_multicard
description: '{{ doc("shared_column_pin_is_multicard") }}'
- name: pin_is_multiland
description: '{{ doc("shared_column_pin_is_multiland") }}'
- name: pin_num_cards
description: '{{ doc("shared_column_pin_num_cards") }}'
- name: pin_num_landlines
description: '{{ doc("shared_column_pin_num_landlines") }}'
- name: pin10
description: '{{ doc("shared_column_pin10") }}'
wagnerlmichael marked this conversation as resolved.
Show resolved Hide resolved
- name: seq
description: '{{ doc("shared_column_seq") }}'
- name: tieback_key_pin
Expand All @@ -110,12 +110,12 @@ models:
description: '{{ doc("shared_column_year") }}'

data_tests:
- row_count:
name: default_vw_card_res_char_row_count
above: 27347200 # as of 2023-11-29
- unique_combination_of_columns:
name: default_vw_card_res_char_unique_by_pin_card_and_year
combination_of_columns:
- pin
- year
- card
- row_count:
name: default_vw_card_res_char_row_count
above: 27347200 # as of 2023-11-29
24 changes: 12 additions & 12 deletions dbt/models/default/schema/default.vw_pin_address.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ models:
description: '{{ doc("shared_column_mail_address_zipcode_1") }}'
- name: mail_address_zipcode_2
description: '{{ doc("shared_column_mail_address_zipcode_2") }}'
- name: prop_address_city_name
description: '{{ doc("shared_column_prop_address_city_name") }}'
- name: pin
description: '{{ doc("shared_column_pin") }}'
- name: pin10
description: '{{ doc("shared_column_pin10") }}'
- name: prop_address_city_name
description: '{{ doc("shared_column_prop_address_city_name") }}'
- name: prop_address_full
description: '{{ doc("shared_column_prop_address_full") }}'
- name: prop_address_prefix
Expand All @@ -37,10 +37,10 @@ models:
description: '{{ doc("shared_column_prop_address_suffix_1") }}'
- name: prop_address_suffix_2
description: '{{ doc("shared_column_prop_address_suffix_2") }}'
- name: prop_address_unit_prefix
description: '{{ doc("shared_column_prop_address_unit_prefix") }}'
- name: prop_address_unit_number
description: '{{ doc("shared_column_prop_address_unit_number") }}'
- name: prop_address_unit_prefix
description: '{{ doc("shared_column_prop_address_unit_prefix") }}'
- name: prop_address_zipcode_1
description: '{{ doc("shared_column_prop_address_zipcode_1") }}'
- name: prop_address_zipcode_2
Expand All @@ -66,18 +66,18 @@ models:
config:
where: CAST(year AS int) BETWEEN {{ var('data_test_iasworld_year_start') }} AND {{ var('data_test_iasworld_year_end') }}
error_if: ">900000"
- expression_is_true:
name: default_vw_pin_address_numeric_pin
expression: REGEXP_COUNT(pin, '[0-9]') = 14 AND LENGTH(pin) = 14
additional_select_columns:
- pin
- row_count:
name: default_vw_pin_address_row_count
above: 45079937 # as of 2023-11-22
- unique_combination_of_columns:
name: default_vw_pin_address_unique_by_14_digit_pin_and_year
combination_of_columns:
- pin
- year
- row_count:
name: default_vw_pin_address_row_count
above: 45079937 # as of 2023-11-22
# No non-numeric characters in the pin field
- expression_is_true:
name: default_vw_pin_address_numeric_pin
expression: REGEXP_COUNT(pin, '[0-9]') = 14 AND LENGTH(pin) = 14
additional_select_columns:
- pin
# TODO: Site addresses are all in Cook County
10 changes: 5 additions & 5 deletions dbt/models/default/schema/default.vw_pin_appeal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ models:
where: CAST(year AS int) BETWEEN {{ var('data_test_iasworld_year_start') }} AND {{ var('data_test_iasworld_year_end') }}
error_if: ">266719"
# `change` should be an enum
- not_accepted_values:
name: default_vw_pin_appeal_class_no_hyphens
column_name: class
values: "2-99"
- expression_is_true:
name: default_vw_pin_appeal_no_unexpected_change_values
expression: change is null or change in ('change', 'no change')
Expand All @@ -106,8 +110,4 @@ models:
where: CAST(year AS int) BETWEEN {{ var('data_test_iasworld_year_start') }} AND {{ var('data_test_iasworld_year_end') }}
- row_count:
name: default_vw_pin_appeal_row_count
above: 8407667 # as of 2023-11-22
- not_accepted_values:
name: default_vw_pin_appeal_class_no_hyphens
column_name: class
values: "2-99"
above: 8407667 # as of 2023-11-22
18 changes: 9 additions & 9 deletions dbt/models/default/schema/default.vw_pin_condo_char.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,22 @@ models:
description: '{{ doc("shared_column_year") }}'

data_tests:
- not_null:
name: default_vw_pin_condo_char_bldg_is_mixed_use_not_null
column_name: bldg_is_mixed_use
- not_null:
name: default_vw_pin_condo_char_card_not_null
column_name: card
- not_null:
name: default_vw_pin_condo_char_char_yrblt_not_null
column_name: char_yrblt
- unique_combination_of_columns:
name: default_vw_pin_condo_char_unique_by_14_digit_pin_and_year
combination_of_columns:
- pin
- year
config:
error_if: ">70297"
- not_null:
name: default_vw_pin_condo_char_card_not_null
column_name: card
- not_null:
name: default_vw_pin_condo_char_char_yrblt_not_null
column_name: char_yrblt
- not_null:
name: default_vw_pin_condo_char_bldg_is_mixed_use_not_null
column_name: bldg_is_mixed_use
# TODO: Non-liveable unit heuristics
# TODO: Row count matches PARDAT for condo classes
# TODO: Non-unit and unit parcel count add up to total parcels per
Expand Down
18 changes: 9 additions & 9 deletions dbt/models/default/schema/default.vw_pin_exempt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ models:
description: '{{ doc("shared_column_latitude") }}'
- name: lon
description: '{{ doc("shared_column_longitude") }}'
- name: pin
description: '{{ doc("shared_column_pin") }}'
- name: owner_name
description: '{{ doc("shared_column_owner_name") }}'
- name: owner_num
description: '{{ doc("shared_column_owner_num") }}'
- name: pin
description: '{{ doc("shared_column_pin") }}'
- name: property_address
description: '{{ doc("shared_column_prop_address_full") }}'
- name: property_city
Expand All @@ -26,16 +26,16 @@ models:
- name: year
description: '{{ doc("shared_column_year") }}'
data_tests:
- row_count:
name: default_vw_pin_exempt_row_count
above: 184845 # as of 2023-11-22
- not_accepted_values:
name: default_vw_pin_exempt_class_no_hyphens
column_name: class
values: "2-99"
# No non-numeric characters in the pin field
- expression_is_true:
name: default_vw_pin_exempt_numeric_pin
expression: REGEXP_COUNT(pin, '[0-9]') = 14 AND LENGTH(pin) = 14
additional_select_columns:
- pin
- not_accepted_values:
name: default_vw_pin_exempt_class_no_hyphens
column_name: class
values: "2-99"
- row_count:
name: default_vw_pin_exempt_row_count
above: 184845 # as of 2023-11-22
Loading
Loading