SQLAlchemy: How to change a MySQL server system variable using SQLAlchemy?

后端 未结 1 1461
抹茶落季
抹茶落季 2020-12-07 02:59

I want to set the general_log and general_log_file variables using SQLAlchemy, is there a way to do this? I\'ve been Googling around and can\'t find anything on the topic.

相关标签:
1条回答
  • 2020-12-07 03:11

    You can execute any raw SQL query which you need (of course you have to get appropriate rights in the session). To change a variable run something like this:

    # change variable name and values to what you need
    connection.execute("SET SESSION query_cache_type = OFF")
    
    0 讨论(0)
提交回复
热议问题