[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sqlalchemy & #temp tables


I am using sqlalchemy (SA) to access a MS SQL Server database (python 3.5, Win 10). I would like to use a temporary table (preferably #local, but ##global would also be an option) to store results of a time-consuming query. In other queries I'd like to access the temporary table again in various places in my Flask app. How do I do that, given that SA closes the connection after each request?

I can do:
with engine.connect() as con:
    con.execute('select * into #tmp from tbl')
    con.execute('select  * from #tmp')

... but that's limited to the scope of the context manager.

Oh, I don't have rights to create a 'real' table. :-(