how to set autocommit = 1 in a sqlalchemy.engine.Connection

后端 未结 5 2167
旧巷少年郎
旧巷少年郎 2021-02-20 00:01

In sqlalchemy, I make the connection:

 conn = engine.connect()

I found this will set autocommit = 0 in my mysqld log. Now I want to set autocom

5条回答
  •  天涯浪人
    2021-02-20 00:33

    This can be done using the autocommit option in the execution_option() method:

    engine.execute("UPDATE table SET field1 = 'test'").execution_options(autocommit=True))
    

    This information is available within the documentation on Autocommit

提交回复
热议问题