On Apr 5, 2008, at 1:13 PM, 张沈鹏(电子科大 毕/就业倒计 
时...) wrote:

> thanks for you answer :)
>
> but I still have some problems
>
> It's to say I should clear session manual once I update the database ?
>
> can I set timeout  somewhere to auto do this job ?
>

for a web application, you usually use a Session for the lifespan of a  
request - at the end of the request, you close it out.

Pylons tutorial has an illustration of this pattern over at 
http://wiki.pylonshq.com/display/pylonsdocs/Using+SQLAlchemy+with+Pylons 
  . About halfway through, the example illustartes modifying the base  
controller to say:

def __call__(self, environ, start_response):
     try:
         return WSGIController.__call__(self, environ, start_response)
     finally:
         meta.Session.remove()

SQLAlchemy 0.4.6 (likely version) will include an "auto-expire-on- 
commit()" feature which will make this step unnecessary, if you use a  
fully transactional Session.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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