Session.merge allows you to attach a detached object

https://docs.sqlalchemy.org/en/13/orm/session_state_management.html#merging

But

What you are describing to me looks like an anti-pattern, as it will have 
wildly unpredictable results if you deploy your application with more than 
one worker (e.g. a multi-threaded or multi-process container) - which is 
the standard.

I think you may want to use a caching layer.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/f8778c30-b6d2-4cf8-abae-1e06e2b50e2e%40googlegroups.com.

Reply via email to