Hi, Using MSSQL, session.flush() doesn't always fetch primary keys back from the database. It works if you explicity specify a sequence, but if the sequence is implicitly created it doesn't fetch. I have raised ticket #415 for this issue.
In MSSQLExecutionContext, it looks to see if any column has a sequence, and if so issues "select @@identity" afterwards. A couple of simple solutions to this: 1) Always issue "select @@identity" (quick tests show this should be safe) 2) Copy the code from MSSQLSchemaGenerator that determines whether to create an implicit sequence, and run it for each query. Thing is, I'm a bit worried about the performance of both those options. I'm wondering why the decision to give a column an implicit sequence is in the database engine code. The fix that seems logical to me is to put the code to create an implicit sequence in Column.__init__. It's down to the individual engines how they implement this sequence, but its existence or not is engine independent. Let me know what you think, 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 -~----------~----~----~----~------~----~------~--~---