7 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Readonly objects/pro...
FromSent OnAttachments
Andreas Jung21 Dec 2007 07:44 
sdob...@sistechnology.com21 Dec 2007 10:52 
Rick Morrison21 Dec 2007 12:13 
Michael Bayer21 Dec 2007 13:33 
Andreas Jung21 Dec 2007 21:33 
Michael Bayer22 Dec 2007 08:02 
klaus18 Jan 2008 07:41 
Subject:[sqlalchemy] Re: Readonly objects/protecting objects from modifications
From:Rick Morrison (rick@gmail.com)
Date:12/21/2007 12:13:03 PM
List:com.googlegroups.sqlalchemy

Something like this is available on a roll-your-own basis via Python properties along with some mapper tricks:

http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mapper_overriding

I would be +1 for such a feature implemented on mapped instances, could be useful for detecting those hard-to-find bugs, but I can't think of a nice and simple API for it. For mapped instances via Query(), it could be an .option(), but I can't see a good way for its use on relation()s. Also not sure if such a feature would throw an exception on attribute setting, or whether it ought to simply be ingored during a flush (OIOW, have it's "dirty" flag locked down to False)