-
Notifications
You must be signed in to change notification settings - Fork 4
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
[1/3] Migrate Will's town close QC reports to dbt models #554
[1/3] Migrate Will's town close QC reports to dbt models #554
Conversation
.flake8
Outdated
[flake8] | ||
ignore= | ||
# Whitespace before ':', incompatible with black | ||
E203, | ||
# Line break before binary operator, incompatible with black | ||
W503 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point should probably just switch this project over to ruff, but in the meantime this flake8 config change is necessary to fix some conflicts between black and flake8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops I think I just biffed this with #564. Will probably need a run through with ruff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Ruff seems to make this config unnecessary so I removed it in 0e41f3e.
@@ -117,19 +138,213 @@ In contrast to `qc.vw_neg_asmt_value`, this view directly performs filtering | |||
for negative values. | |||
{% enddocs %} | |||
|
|||
# vw_sale_mydec_null_values | |||
# vw_report_town_close_0_land_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the docs blocks for the new reports are listed in the order that Will runs them, which made it easier for me to track my progress during development, but I can rearrange them to be in alphabetical order if we have a strong preference for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just quickly order them alphanumerically yeah, for consistency with the other docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, done in 3744e48! Remind me whether we normally also order the schema files this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schema files should be alphanumerically ordered. The docs files are kind of a mixed bag (some are broken up by section), but are usually alphanumeric also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I also reordered the schema file in 10e033f. Sorry for the annoying diff! I didn't change anything and checked with a dbt compile
that the graph still compiles correctly, which should hopefully rule out any obvious copy/paste errors.
dbt/models/qc/schema.yml
Outdated
- name: '% Change' | ||
index: M | ||
horizontal_align: right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the PR body, this is the new syntax for specifying formatting that should be applied to the export workbook at runtime. This is necessary because (as far as I can tell) you can't set horizontal alignment in an Excel template before you populate it with data using openpyxl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: When you build up the docs for the QC reporting exports, let's be sure to enumerate the possible options here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good flag, I've added a note on this to #539.
dbt/models/qc/qc.vw_iasworld_asmt_all_with_prior_year_values.sql
Outdated
Show resolved
Hide resolved
.flake8
Outdated
[flake8] | ||
ignore= | ||
# Whitespace before ':', incompatible with black | ||
E203, | ||
# Line break before binary operator, incompatible with black | ||
W503 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops I think I just biffed this with #564. Will probably need a run through with ruff.
@@ -117,19 +138,213 @@ In contrast to `qc.vw_neg_asmt_value`, this view directly performs filtering | |||
for negative values. | |||
{% enddocs %} | |||
|
|||
# vw_sale_mydec_null_values | |||
# vw_report_town_close_0_land_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just quickly order them alphanumerically yeah, for consistency with the other docs.
dbt/models/qc/qc.vw_iasworld_asmt_all_with_prior_year_values.sql
Outdated
Show resolved
Hide resolved
dbt/models/qc/qc.vw_report_town_close_improved_class_without_bldg_value.sql
Show resolved
Hide resolved
dbt/models/qc/schema.yml
Outdated
- name: '% Change' | ||
index: M | ||
horizontal_align: right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: When you build up the docs for the QC reporting exports, let's be sure to enumerate the possible options here.
47810e9
to
3744e48
Compare
…when result set has only 1 row
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this looks great @jeancochrane!
Overview
This PR is the first of three following up on #534 by adding a bunch of models and Excel templates to recreate the QC reports that Will sends out on town close.
This PR migrates the following reports that all share common logic:
The subsequent PRs finishing the migration are #556 and #557. I've tried to group PRs according to reports that share common logic, with the third PR being a grab bag of miscellaneous reports.
We make a few other small changes to support this effort:
qc.vw_change_in_ahsap_values
andqc.vw_report_town_close_neg_asmt_value
) get refactored to remove hardcoded dates, in line with other QC modelsdbt/scripts/export_models.py
script is extended to support reading aconfig.meta.export_format.columns
attribute from the schema config, which is used to set formatting options for the output Excel workbooks that can't be set in the template (such as right-aligning text data columns)Testing
To recreate 2024 Jefferson township reports for the purposes of testing, run the following command in the
dbt/
subdirectory:The reports will be output to the
dbt/export/output/
directory.