On Sep 3, 2007, at 4:38 AM, che wrote:

>
> Hi,
>
> this issue (#759) seems fixed with the SA0.4b5. Thanks, Michael.
>
> One additional question concerning last_inserted_ids() - is it
> supposed to work below:
> ...
>     isql = Insert( table_Manager, values= {'name':bindparam('name'),
> 'duties':bindparam('duties
>     r2 = con.execute( isql, [
>         dict( name= 'torencho', duties= 'bany'),
>         dict( name= 'mnogoVojdMalkoIndianec', duties= 'lany'),
>     ])
>     ids = r2.last_inserted_ids()
> ...
> or i am using it improperly?
> as it is now on the trunk(r3449) it gives error: "AttributeError:
> 'PGExecutionContext' object has no attribute '_last_inserted_ids'".
>

OK, well the code needs to be cleaned up such that you get None and  
not an attribute error there, but the "last_inserted_ids"  
functionality only works when you execute a single set of  
arguments.   the reason for this is that DBAPI doesnt even define any  
way to get at list of last inserted ids for an executemany() (i.e. it  
only has cursor.lastrowid at best).  With PG we execute a sequence,  
but we still dont go through the extra overhead of storing it for  
every row of the executemany, and in the latest release ive optimized  
executemany a lot more so that we arent even "pre" executing the  
sequence.

the name of the method is actually not that great, its plural "ids"  
because of the potentially mulitple PK columns from a single row.     
So in this case it should be returing None.



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