That design is definitely flawed.

Read up on the ORM session documentation, and pay attention to "Merging",

The session encapsulates a bit of logic and a unit of work.  Once you close 
a session, the objects within it are considered to be out-of-phase. 
 Accessing their attributes -- even only for a read -- requires a new 
database session/transaction to ensure that the data is the same.

Sessions should generally last the length of a web request -- unless you 
have very specific business requirements that necessitate otherwise.  In 
your case, you don't.  Just start a session at the beginning of each 
request.  You'll overcomplicate everything otherwise.

-- 
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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to