On Nov 7, 2007, at 12:58 PM, Werner F. Bruhin wrote:

>
> Mike,
>
> Michael Bayer wrote:
>> On Nov 7, 2007, at 12:32 PM, Werner F. Bruhin wrote:
>>
>>
>>> Can you point out what I did wrong, please.
>>>
>>>
>>
>> id have to see a larger example, seems like something is marking the
>> column as modified when it should not be.
>>
> I put a little test case together, which does very little but I get  
> the
> exception.


oh sorry, I misread the source code in SA earlier...for an INSERT, we  
are going to insert "None" for all columns that are blank but dont  
have a default.  so your two options here are to put another  
PassiveDefault on the column:

    Column(u'consumedvalue',  
Numeric(precision=18,length=2,asdecimal=True), PassiveDefault("")),

or you can leave the column out of the mapping entirely (but then  
reading it requires an extra query):

   mapper(Consumption, consumption_table,  
exclude_properties=['consumedvalue'])

the consumedvalue column will post-fetch after an INSERT statement.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to