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

call make_transient on instance during rehydration if adding fails #41

Closed
wants to merge 2 commits into from

Conversation

c0state
Copy link

@c0state c0state commented Sep 17, 2020

I'm getting this exception https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_3_19/lib/sqlalchemy/orm/session.py#L2343 in some of my tests where a record is accessed and then deleted. Per the upstream recommendation, this captures that exception and tries calling make_transient instead.

All other errors are (re-)thrown

I'm getting this exception https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_3_19/lib/sqlalchemy/orm/session.py#L2343 in some of my tests where a record is accessed and then deleted. Per the upstream recommendation, this captures that exception and tries calling `make_transient` instead.

All other errors are (re-)thrown
@c0state
Copy link
Author

c0state commented Nov 30, 2020

@jeancochrane thoughts?

Copy link
Owner

@jeancochrane jeancochrane left a comment

Choose a reason for hiding this comment

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

Great catch here @c0state, are you able to share a quick test that we might be able to use to verify this change does what we expect?

pytest_flask_sqlalchemy/fixtures.py Outdated Show resolved Hide resolved
Co-authored-by: Jean Cochrane <jeancochrane@users.noreply.github.com>
@c0state
Copy link
Author

c0state commented Dec 14, 2020

Great catch here @c0state, are you able to share a quick test that we might be able to use to verify this change does what we expect?

One of my tests in a private repo fails. This PR definitely fixes it, but I'm unsure why at the moment TBH.

I think #25 also is similar. The comment about the flask test client causing this matches my experience. It seems removing the add call would work too--unsure where it's used or why it's needed though.

@c0state c0state closed this Mar 25, 2021
@c0state c0state deleted the patch-3 branch March 25, 2021 20:18
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

2 participants