Re: [sqlalchemy] problems with temporary tables and commits

2013-08-24 Thread Tim Tisdall
I probably should have mentioned also that I was using pyramid with pyramid_tm. The MySQL docs make a point of stating that "CREATE TEMPORARY TABLE" never autocommits like a regular "CREATE TABLE". Okay, I'll probably just stick with sending a "COMMIT" and try that alternate method too. I'm alwa

Re: [sqlalchemy] problems with temporary tables and commits

2013-08-23 Thread Michael Bayer
well a CREATE TABLE will autocommit but only if it's on an Engine that's not already in a transactionand when you use a Session it sets up a transaction that stays open until you say commit(). I can see the problem here, one way around is to actually bind the Session to a connection like t

Re: [sqlalchemy] problems with temporary tables and commits

2013-08-23 Thread Tim Tisdall
I knew I'd find a possible solution right after asking... Isn't that always the way? I found that I can do DBSession.execute("COMMIT") to get MySQL to commit the temporary table but SQLAlchemy/transaction doesn't seem to pick up on it and I don't lose the connection to the threadpool. This seems

[sqlalchemy] problems with temporary tables and commits

2013-08-23 Thread Tim Tisdall
I'll try to make this succinct... I'm creating a temporary table and then doing a query with it that takes a good length of time. I found that the source tables going into the temporary table were being locked after the temporary table was created even though they were no longer needed for the