I am using threadlocal. Is there any global name that I can call in atexit function. The atexit function is registered before any database stuff is accessed. The engine create is ' engine = create_engine(connect_string, strategy='threadlocal')'. In the atexit function I just want to close out any active because the port will not be there. There are a number of engine. One is created for each database that I need to access.
Michael Bayer wrote: > maybe engine.dispose() to explicitly close off everything first > > > On Jul 23, 2006, at 6:15 PM, Mike Bernson wrote: > >> I am using ssh to port forward the connection to the database. >> >> I have some code that execute before any sqlalchemy that sets up a >> port forward from local host to mysql database host. In this function >> I do atexit to kill off the ssh that has the port forward. >> >> I get a the following error when the program exits: >> Exception _mysql_exceptions.OperationalError: (2006, 'MySQL server has >> gone away') in <bound method ConnectionFairy.__del__ of >> <sqlalchemy.pool.ConnectionFairy object at 0x2aaaad4c8d90>> ignored >> >> Is there something that I can put in the atexit function clear up this >> error ? >> >> Is there something I can put as the last statements to be executed >> that >> would clean up this error (for normal execution path) >> >> The atexit is done so that no matter how the program exits the ssh is >> killed off. >> >> ---------------------------------------------------------------------- >> --- >> 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 ------------------------------------------------------------------------- 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