the ExecutionContext is created internally by the engine when the statement is executed.  its associated with the ResultProxy that gets returned from all statement executions, and ResultProxy has convenience functions on it so you dont have to deal with it directly.  so try it like this:

i = table.insert()
c = i.execute(params)
lastinsertedids = c.last_inserted_ids()

if there were ever a SQLAlchemy book, this is the kind of stuff we'd have to elaborate on (are you listening, Tim Oreilly ?)

On Sep 1, 2006, at 9:43 AM, Warren Emmett wrote:

Hi,

Im new to sqlachemy and sql in general but I have created several tables using sqlalchemy with simple joins using primary and foreignkeys. I am populating the main table allowing autogeneration of primarykeys for each row and my problem is that i want to recall this primarykey to use in the secondary tables as foreignkeys

i found the last_inserted_ids(self) command and i have pasted my commands below

from sqlalchemy.engine import ExecutionContext
.....
i = main_seq_table.insert()

i.execute({'seq_length': seq_length,'seq_name'
: seq_name,'seq_descr': seq_descr,'seq_path'
: seq_path,'pattern_name': pattern_name})


temp = ExecutionContext()
	
s = temp.last_inserted_ids()

This doesnt work and gives a "NotImplementedError".

I cant find a coding example for this and I have no idea what else to do, please help!

Thanks

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Sqlalchemy-users mailing list

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to