Michael,
Michael Bayer wrote:
>
> On Jun 17, 1:06 pm, "Werner F. Bruhin" <[EMAIL PROTECTED]> wrote:
>
>> I just got beta1 and I run into a problem with the following:
>>
>> sa.Column(u'consumedvalue', sa.Numeric(precision=18, length=2,
>> asdecimal=True), sa.PassiveDefault("")),
>>
>> consumedvalue is a readonly column (i.e. computed by Firebird SQL) and I
>> am getting the following exception when I try to debug (in Boa), the
>> same happens if I change the above to use ....server_default="".
>>
>> Do I need to change something else in the model. For each of these type
>> of columns I also have the following:
>>
>> class Consumption(object):
>> def consumedvalue(self):
>> return self._consumedvalue
>> consumedvalue = property(consumedvalue)
>>
>
> the mapper will automatically map the "consumedvalue" column to the
> "consumedvalue" attribute on the class. The descriptor you've placed
> there conflicts with it. You need to tell the mapper about the
> "_consumedvalue" name you're using, which is illustrated here:
> http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_mapper_overriding
>
I already have this (see below), sorry forgot to mention this before.
Note that my model worked under 0.4.3 and it does in 0.5beta1, i.e. I
can insert a record into Consumption. I only get the exception shown in
the previous email when I try to run it through the debugger (to check
something unrelated to SA).
Werner
consumption = sao.mapper(Consumption, consumption_table,
properties={
'reason_ls': sao.relation(Reason_Ls),
'rating': sao.relation(Rating),
'cbbottle': sao.relation(Cbbottle),
'cellar': sao.relation(Cellar),
'_consumedvalue': consumption_table.c.consumedvalue,
'consumedvalue': sao.synonym('_consumedvalue'),
})
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---