Hello,

My question is regarding long-running tasks and db sessions. Currently I 
have the very rare situation where a task takes longer than a db session is 
valid and thus fails when it wants to write back results. Extending the TTL 
of a db session is probably not a good idea.

I think the proper approach would be to open a db session, fetch data, 
close the db session, do work, open a new db session, write data, close the 
db session. So, I must make sure that I fetch all data ahead of time while 
the first session is active.

Is there a way to re-associate objects that belonged to the first session 
with a newly opened one? What’s the recommended approach here, does SQLA 
have any magic in store to help me with very long-lived ORM objects across 
db sessions? Or should I manage that data independently of their respective 
ORM objects?

Thanks!
Jens

-- 
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/96e71deb-b996-4695-8527-5a3b5bceff45n%40googlegroups.com.

Reply via email to