Is there something easier than ORM?
J. Cliff Dyer
jcd at sdf.lonestar.org
Tue Feb 17 10:27:57 EST 2009
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.
More information about the Python-list
mailing list