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

后端 未结 5 2464
旧巷少年郎
旧巷少年郎 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:20

    You can use this:

    from sqlalchemy.sql import text
    
    engine = create_engine(host, user, password, dbname)
    engine.execute(text(sql).execution_options(autocommit=True))
    

提交回复
热议问题