BTW the "assume autoincrement for integer PK" behavior is a hangover from
the early days of the module, where I originally copied from the PG
module. Since PG doesn't have the funky "it's ok to explicit ID insert now"
mode, the problem doesn't surface there.

I think the behavior was meant more for explicit table definition than
for reflected tables, but there's a bit of muddle between the two.


There was some new MSSQL reflection code posted a couple of months ago that
might do a better job of sniffing the actual state of
the IDENTITY column. Instead of reading from the INFORMATION_SCHEMA views, I
think it did some lower-level system table queries.

The point of the code was for performance reasons, not correctness,
but it may be worth a second look.


(Hey what is with the weird text wrap in Gmail and OSX Opera 9? It's
annoying.
Forces
you
to
make
new
lines
)

Rick

On 10/7/07, Paul Johnston <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> >>Try adding autoincrement=False to the t_year column.
> >>
> >>
> >why would this fix the issue exactly ?
> >
> >
> Fair question. The explanation is a bit convoluted, not as nice and
> simple as the fix.
>
> MSSQL's equivalent of SERIAL/autoincrement is an "identity" flag on a
> column. To insert an explicit value into that, you have to issue "set
> identity_insert <table> on". The MSSQL dialect does this for you
> automatically, and that was the statement failing in Paulino's example.
> The MSSQL dialect also automatically gives a column the identity flag if
> it's an integer primary key, and autoincrement is true. So it would have
> for t_year. Paulino is using table reflection, and I reckoned the real
> db table does not have the identity flag - it would certainly be odd to
> put that on a year column.
>
> Regards,
>
> Paul
>
> >
>

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