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 table updates #49

Merged
merged 2 commits into from
Mar 24, 2023
Merged

Fix table updates #49

merged 2 commits into from
Mar 24, 2023

Conversation

pganssle
Copy link
Owner

This fixes an issue where updating existing entries in the database would fail because they were not being properly deleted first.

SQLAlchemy maps specific instances to the objects in the database. If
the object is mutated in-place, adding it to the table again will issue
an UPDATE, but if the object is replaced with a new instance, you need
to delete it first, then re-add it, otherwise it will fail the UNIQUE
constraint, since it's trying to add the same thing twice.
@pganssle pganssle merged commit dd059e2 into master Mar 24, 2023
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.

None yet

1 participant