Skip to content

Fixup get transaction#66

Closed
tdamsma wants to merge 5 commits into
zopefoundation:masterfrom
tdamsma:fixup-get_transaction
Closed

Fixup get transaction#66
tdamsma wants to merge 5 commits into
zopefoundation:masterfrom
tdamsma:fixup-get_transaction

Conversation

@tdamsma
Copy link
Copy Markdown
Contributor

@tdamsma tdamsma commented Apr 30, 2021

I just realized I made a mistake in #62, checking for get_transaction on the transation instead of the session. Luckily SQLALchemy 1.4 is still backwards compatible, so that is why it didn't fail in the tests and shouldn't have any consequences for the moment.

And upon closer inspection, session.transaction (that is deprecated in 1.4+) returns the current (possibly nested) transaction and starts a new one if there is none. SQLALchemy 1.4+ makes a distinction between getting

I added explicit checks for SQLALchemy >= 1.4.0 instead of hasattr/getattr, and made the distinction between nested and root transaction more explicit.

Not sure why I need to call root_transaction = session.get_transaction() or session.begin() and not just root_transaction = session.begin() as it seems to me that that should be equivalent; It seems to me that begin() should return the current root transaction if there is one but apparently this is not the case.

@tdamsma tdamsma marked this pull request as draft April 30, 2021 11:25
@tdamsma tdamsma requested a review from icemac April 30, 2021 12:37
@tdamsma tdamsma marked this pull request as ready for review April 30, 2021 12:38
@tdamsma tdamsma requested a review from sallner April 30, 2021 12:38
Copy link
Copy Markdown
Member

@icemac icemac left a comment

Choose a reason for hiding this comment

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

Generally it looks good to me.

Additionally a change log entry referencing the PR would be helpful.

Comment thread src/zope/sqlalchemy/datamanager.py
Comment thread src/zope/sqlalchemy/datamanager.py
@tdamsma
Copy link
Copy Markdown
Contributor Author

tdamsma commented May 10, 2021

Additionally a change log entry referencing the PR would be helpful.

Would this be version 1.5.0 or 1.4.1, as it is a fix of 1.4.0?

@icemac
Copy link
Copy Markdown
Member

icemac commented May 11, 2021

Would this be version 1.5.0 or 1.4.1, as it is a fix of 1.4.0?

I think 1.4.1 would be fine as it is a bugfix.

This was referenced Jun 29, 2021
@icemac
Copy link
Copy Markdown
Member

icemac commented Jul 1, 2021

Is there still something which prevents us from merging this PR?

@silenius silenius closed this in #68 Jul 13, 2021
@icemac
Copy link
Copy Markdown
Member

icemac commented Jul 14, 2021

Thank you for this PR, it was included in #68 and is not in the 1.5 release of this package. Hopefully the change log entry I wrote meets the intention of this PR.

@tdamsma
Copy link
Copy Markdown
Contributor Author

tdamsma commented Jul 14, 2021

@icemac, @silenius sorry for not following up on this earlier, should have wrapped it up myself but it fell off my radar. Thanks!

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.

2 participants