On Sep 6, 2011, at 2:48 PM, Michael Bayer wrote:

> 
> On Sep 6, 2011, at 2:38 PM, Mark Erbaugh wrote:
> 
>> Let's say there is a mapped (declaratively, but that shouldn't matter) 
>> class, Data, that has fields Data.value1, ... Data.value10.
>> 
>> There is also an instance of this class, data that is populated from the 
>> data table.
>> 
>> Obviously, you can get the values using data.value1, ...
>> 
>> But is there a simple way to get a data value using the instance object 
>> (data) and a class field (Data.value1).
>> 
>> What's the easiest way given data and Data.value1 to get / set that value of 
>> data.value1? 
> 
> Data.value1 is a Python descriptor, so Data.value1.__get__(data, Data) would 
> do it.    Or getattr(data, Data.value1.key) as "key" is present on the SQLA 
> instrumented attribute.
> 

Thanks.

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to