Thanks for the responses guys.  The PassiveDefault("") parameter did
exactly what I wanted it to do - which was to exclude that column from
the generated insert query so that MS SQL could handle those on it's
own.

... now to figure out why I am getting an unsubscriptable object type
error from the operation:
-----------------------------------
...
File "c:\python24\lib\site-packages\sqlalchemy-0.3.11-py2.4.egg
\sqlalchemy\orm\mapper.py", line 1255, in _postfetch
    self.set_attr_by_column(obj, c, row[c])
TypeError: unsubscriptable object
-----------------------------------

the comments for the _postfetch method indicate that it is checking to
see if 'PassiveDefaults' were fired off on the insert.  It looks the
row[c] operation is breaking as the row object doesn't support []
subscripting...   could be a bug?


On Jan 11, 9:11 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> 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/749c55...
>
> > 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