Skip to content

why should Session.expire_on_commit be set to False when using asyncio? #11495

Answered by CaselIT
0-th asked this question in Usage Questions
Discussion options

You must be logged in to vote

Hi,

It's just a suggestion to avoid having to manually refresh an object after a commit. Using async you cannot lazy load expired attributes after a commit like you would in case of sync code.
Note that there is a way of having lazy load work with asyncio, see AsyncAttrs https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html#sqlalchemy.ext.asyncio.AsyncAttrs

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 0-th
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants