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

fix: set non-required fields as nullable #63

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

lchen-2101
Copy link
Collaborator

closes #62

Copy link

Coverage report

The coverage rate went from 86.28% to 86.64% ⬆️
The branch rate is 85%.

100% of new lines are covered.

Diff Coverage details (click to unfold)

src/entities/models/dao.py

100% of new lines are covered (100% of the complete file).

src/entities/models/dto.py

100% of new lines are covered (100% of the complete file).

src/entities/repos/institutions_repo.py

100% of new lines are covered (97.43% of the complete file).

Copy link
Contributor

@jcadam14 jcadam14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thumbs up

Copy link
Member

@hkeeler hkeeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@@ -74,6 +74,22 @@ async def upsert_institution(session: AsyncSession, fi: FinancialInstitutionDto)
session.add(db_fi)
else:
db_fi.name = fi.name
db_fi.tax_id = fi.tax_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to hold up this PR over this, but might be worth checking into SQL Alchemy's built-in upsert functionality.

It'd at least remove the duplicate property setting bits...I think. Of course, there's probably a performance question to consider for this endpoint since it's probably going to be hit a lot at least during initial institution data load. Then again, we'll probably want to support a bulk upload in the long run, so many it's not an issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap, this endpoint was originally thought of as a "convenience" endpoint; when we load actual data, it should be outside of using the API; I'll create a ticket on the upsert part, had a glance at the beginning and they were more direct table insertion based rather than the ORM way of doing things; doesn't hurt to see of the ORM upsert is there, and easily implementable, would certainly get rid of a lot of boilerplate.

@lchen-2101 lchen-2101 merged commit a699231 into main Dec 13, 2023
3 checks passed
@lchen-2101 lchen-2101 deleted the fix/62_set_institution_nullable_fields branch December 13, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set Institution dao / dto optional fields
3 participants