On Tue, 2009-02-17 at 06:15 -0800, 一首诗 wrote: > Thanks for your reply. > > With sqlalchemy, an mapped must living in a session, you have no way > to disconnect it with its session. > > For example : > > #------------------------------------- > user = session.query(User).first() > session.expunge(user) > print user.name #Error here > #------------------------------------- > > I just want to get an read-only copy of user disconnected with session > to avoid unexpected database operation. > But after expunge, properties of user is not accessible anymore.
For that, the Right Thing to Do(tm) is to log in to your session with read-only permissions. -- http://mail.python.org/mailman/listinfo/python-list