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

expunge instances before restarting nested transaction #40

Closed
wants to merge 1 commit into from

Conversation

c0state
Copy link

@c0state c0state commented Sep 17, 2020

Should this call expunge_all instead of expire_all?

I'm seeing some test failures with stale instances that hit https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_3_19/lib/sqlalchemy/orm/session.py#L2603 if only expire_all is called.

At this point, uncommitted instances can be disregarded I believe?

Should this call `expunge_all` instead of `expire_all`? I'm seeing some test failures with stale instances that hit https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/orm/session.py#L3186 if only `expire_all` is called. At this point unsaved instances can be disregarded I believe?
@@ -56,7 +56,7 @@ def restart_savepoint(session, trans):
if trans.nested and not trans._parent.nested:
# ensure that state is expired the way
# session.commit() at the top level normally does
session.expire_all()
session.expunge_all()
Copy link
Author

Choose a reason for hiding this comment

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

Might want to change above comment if this is accepted

@c0state
Copy link
Author

c0state commented Sep 29, 2020

@jeancochrane any thoughts on this and #41 ?

@jeancochrane
Copy link
Owner

Sorry for the extra late reply here @c0state, do you have a sample test I can use to verify the problem?

@c0state c0state closed this Mar 25, 2021
@c0state c0state deleted the patch-1 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