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: updated upsert to flush and refresh the dao before returning #86

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

lchen-2101
Copy link
Collaborator

closes #85

Copy link

github-actions bot commented Jan 5, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/entities/repos
  institutions_repo.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Contributor

Choose a reason for hiding this comment

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

From what I have read and seen in my own usage of it, the session.merge() function does what we would need here. If the object isn't in the db (based on the PK), it'll add it. If it is, it'll udpate (so upsert). The merge function returns the object that was added/updated in the db with the new values. So I think we could use that here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

perfect, I even saw you using it... didn't click here... will try it out, thanks.

@lchen-2101 lchen-2101 merged commit bef4871 into main Jan 8, 2024
3 checks passed
@lchen-2101 lchen-2101 deleted the fix/85_fix_upsert_serialization_error_on_response branch January 8, 2024 18:32
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.

Bug: initial upsert call to add institution fails serialization
2 participants