-
Notifications
You must be signed in to change notification settings - Fork 7
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
Syncronize our SQLAlchemy type hints with db schema #2197
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2197 +/- ##
==========================================
- Coverage 91.09% 91.08% -0.01%
==========================================
Files 363 363
Lines 41226 41200 -26
Branches 8835 8827 -8
==========================================
- Hits 37555 37529 -26
- Misses 2406 2407 +1
+ Partials 1265 1264 -1 ☔ View full report in Codecov by Sentry. |
This is okay to get a code review but I need to fix up the migrations parent before it gets merged due to the migration in #2198. |
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.
This looks good! 🗺️
There are some cases we have not added an annotation. Was that intentional? What is the rationale for whether we are adding one or not?
@tdilauro every Only |
Fix down revision
db89e62
to
905a0b6
Compare
Description
Make sure what what is defined in our SQLAlchemy schema is accuratly reflected in the type hints:
relationship
is not a collection, and its foreign key column is nullable make sure the annotation is Optionalnullable=False
to the foreign key column.nullable=False
primary_key=True
nullable=False
and appropriately set annotation for columns that havedefault
setMotivation and Context
Our sqlalchemy type hints have been added over time, and some of them did not accurately reflect what was in the DB schema. I noticed this while working on #2194.
These changes meant that I had to add some guard code for errors that mypy rightly flagged. It also meant that I could remove some guard code that was no longer necessary.
How Has This Been Tested?
Checklist