Here is a short test program. In fact, the problem seems to be that SQLAlchemy try to UPDATE an object loaded from the secondary mapper, as this object's got an _instance_key.
As the script demonstrate, removing the _instance_key forces SQLAlchemy to INSERT. But I don't think that messing with _instance_key is safe... Taking this situation into account when deciding to insert or update in mapper.save_obj seems to be the good solution, but i'm new to SQLAlchemy and it may be more complicated than that... Please tell me if I can be of any help with this.
sa test.py
Description: Binary data
------------------------------------------------------------------------- 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 Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users