On Mar 31, 3:07 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> The other thing you're probably hitting here is that the Session is  
> going to cache everything it loads until you clear out its data  
> (session.clear()) , or expire the data that it has loaded  
> (session.expire_all()).  This is why it tends to work more nicely with  
> "transactional=True" in that regard.

OK, makes sense - the session behavior matches the transaction
behavior.

> The pattern in your application  
> of creating one global session might be better be served by creating  
> sessions per unit of work, i.e. on an as-needed basis (or perhaps  
> within the scope of your Sucrose object).  If its not a web  
> application, where the boundaries for creating sessions are very  
> simple (i.e. once per request), then you have to figure out what  
> boundaries you want to have amongst concurrent processes in your  
> application.

session.clear() works.  The primary reason I'm using sessions outside
a transaction is so I don't have to worry about what database I'm
accessing.  The app is not a webapp, but creating a per-user session
would be pretty trivial.

Thanks again.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to