On Nov 27, 2007, at 11:18 AM, Jason R. Coombs wrote:

>
> This issue seems to be causing me some trouble as well.  Using
> sqlalchemy-0.4.2dev_r3832, I'm getting the following error when
> attempting to flush my session:
>
>    if not len(self._last_inserted_ids) or self._last_inserted_ids[0]
> is None:
> AttributeError: 'MSSQLExecutionContext_pyodbc' object has no attribute
> '_last_inserted_ids'
>
> I presume this is one of the unit tests that are currently failing,
> but I wanted to mention that I'm experiencing trouble with this is in
> practice as well.  I get the same error in 0.4.0.  I did not encounter
> this problem in 0.3.x.
>
> Let me know if a fix is not in the works for this issue and what I can
> do to provide more helpful details.
>

im not sure if theres a ticket in trac for this but the fix is as such  
(MSSQL people please test/commit); the comment says "turn off  
INDENTITY_INSERT" but I dont see where that's happening; if its one of  
those SELECT statements, and it needs to happen for executemany as  
well, then the patch below needs to be adjusted:

Index: lib/sqlalchemy/databases/mssql.py
===================================================================
--- lib/sqlalchemy/databases/mssql.py   (revision 3832)
+++ lib/sqlalchemy/databases/mssql.py   (working copy)
@@ -333,7 +333,7 @@
          one column).
          """

-        if self.compiled.isinsert and self.HASIDENT and not  
self.IINSERT:
+        if self.compiled.isinsert and self.HASIDENT and not  
self.IINSERT and not self.executemany:
              if not len(self._last_inserted_ids) or  
self._last_inserted_ids[0] is None:
                  if self.dialect.use_scope_identity:
                      self.cursor.execute("SELECT scope_identity() AS  
lastrowid")





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