Skip to content
Discussion options

You must be logged in to vote

After you call session.commit(), objects liked to this session expire. Next time you try accessing their properties, SQLAlchemy will try refreshing it automatically. But by that time your session is closed and it fails.

So, calling await db.refresh(entry) is right way to do it

Read more: https://sqlmodel.tiangolo.com/tutorial/automatic-id-none-refresh/

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
3 participants