the most likely cause is the "threadlocal" mod is being imported somewhere in the production application. this creates a SessionContext that is globally associated with all mappers, and is used when new object instances are created.
try to see if "sqlalchemy.mods.threadlocal" is imported anywhere and remove it. another cause is if youre using a SessionContext yourself, either with assign_mapper or as an extension to mappers, but that would be pretty obvious. On Jul 19, 2006, at 6:02 PM, Randall Smith wrote: > I've an issue I haven't been able to figure out just yet and I'm > hoping > to gain some insight. I have a simple script that adds child > records to > a parent like so: > > new_child = Child() > new_child.name = 'test' > parent.append(child) > > Here is the weird part. On the dev machine it works fine. On the > production machine, I get an error about new_child already being > attached to a session so parent and new child are in different > sessions. > I'm running the same version of SA on both machines. Doing some > introspection I found this: > > On the dev machine: > object_session(new_child) == None > > On production: > object_session(new_child) == <sqlalchemy.orm.session.Session > object > at 0x40a3c3ac> > > When I create new_child on production, it is automatically attached > to a > session. What would cause this? > > Randall > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys -- and earn > cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Sqlalchemy-users mailing list > Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users