I have two databases with one session for each of them. I would like to move objects contained in one of them to the other. I tried to get an object from the first with something like:
obj = sessionA.query(MyClass).filter(MyClass.name == 'some name') and then I tried to add this object to the second session with: sessionB.add(obj) sessionB.commit() but I get this exception: Object '<User at 0xnnnnnnnn>' is already attached to session '1' (this is '2') How could I overcome this exception and be able to move this object? Is there a way to do this? Thanks -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.