If you Session.remove() at the end of a request, you also generally
want to throw away all the objects you were dealing with for that
request and load them fresh in the new request.

SQLAlchemy 0.5 will have a feature where all objects get "expired"
automatically after a session does a rollback() or a commit().   If
you wanted an alternative right now to Session.remove(), you could say
Session.expire_all() which would remove all the loaded state from all
objects in-place, and every attribute access would result in a re-load
from the DB.

But it still at the end of the day issues SQL for everything anyway in
that case, so it seems simpler just to not carry anything over between
requests.

Carrying things over between requests also suggests that objects might
be shared between threads which is generally a bad idea with ORM
mapped objects, since they can change their internal state upon
attribute access (i.e. because they issue loads from the DB).


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to