Skip to content

fix creation exception handling and body serialize#21

Open
Zenor27 wants to merge 2 commits intomainfrom
20-uniq-key-create-error
Open

fix creation exception handling and body serialize#21
Zenor27 wants to merge 2 commits intomainfrom
20-uniq-key-create-error

Conversation

@Zenor27
Copy link
Owner

@Zenor27 Zenor27 commented Oct 17, 2022

No description provided.

Copy link

@dsmurrell dsmurrell left a comment

Choose a reason for hiding this comment

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

Thank you!

It looks like the same setup is required for the patch endpoint. I've just tested with the same output error. If I make the name field unique on User, then try to update one user to have the same name as another user, on the next database transaction I get the same PendingRollbackError: This Session's transaction has been rolled back due to a previous exception during flush. error.

self.session.commit()
return obj
try:
self.session.commit()

Choose a reason for hiding this comment

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

Is it possible that someone could use def update_one(self, id_: int, **kwargs) -> object: and set some unique field to a value that already exists in another row which would throw up the same issue?

Copy link
Owner Author

Choose a reason for hiding this comment

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

indeed, I need to fix the update_one method as well :)

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.

Error in follow up transactions after trying to insert a user with the same ID

2 participants