On Jan 10, 2008, at 9:15 PM, deanH wrote:

>
> Hello,
>
> I am having a problem inserting an object into a MS SQL table that
> contains a timestamp field (now) that is generated automatically -
> sqlalchemy is defaulting this column to None and when it is generating
> the SQL insert.  Is there a way to configure the mapper so that it
> ignores specific columns?
>
> I looked at the related topic below, but that is resolved by using a
> sqlalchemy construct specific to primary keys, and i have not seen one
> that is designated for timestamps.
> http://groups.google.com/group/sqlalchemy/browse_thread/thread/749c55a835b7458/51b38f4b08d31d6f?lnk=gst&q=column+exclude#51b38f4b08d31d6f
>
> I am new to sqlalchemy so I may be going about this the wrong way, but
> my attempts at overriding with a reflected column were similarly
> unsuccessful.
>
> Column('now', MSTimeStamp, nullable=False)
>
> Any thoughts on how to exclude columns from generated inserts?

assuming there is an MS-SQL-side default generator for the column, you  
just need to tell your Table definition that the column is capable of  
populating itself, via:

    Column('now', MSTimeStamp, PassiveDefault(""), nullable=False)

hope this helps



--~--~---------~--~----~------------~-------~--~----~
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