“set session” in a SQLAlchemy session object

后端 未结 3 2185
无人共我
无人共我 2021-01-19 08:20

I\'m using SQLAlchemy for a project, and need to be able to specify a session variable/setting for one specific call for performance reasons:

set session max         


        
3条回答
  •  孤独总比滥情好
    2021-01-19 08:41

    I finally ended up doing this to get it working:

    Session = sessionmaker()
    ...
    session.connection().execute('SET max_heap_table_size = 1024 * 1024 * 64');
    

    The SQLAlchemy event didn't seem to work, but then again, its possible I wasn't doing it exactly right.

提交回复
热议问题