snower / TorMySQL

The highest performance asynchronous MySQL driver by PyMySQL
MIT License
308 stars 63 forks source link

How can I set autocommit? #27

Closed fatpo closed 6 years ago

fatpo commented 6 years ago

how can I set autocommit? just like pymysql:

Connection.autocommit(True)

my config:

db_pool = tormysql.ConnectionPool(
    max_connections=50,  # max open connections
    idle_seconds=180,  # conntion idle timeout time, 0 is not timeout 连接空闲超过idle_seconds 后会自动关闭回收连接的
    wait_connection_timeout=3,  # wait connection timeout
    host=settings.db_host,
    user=settings.db_user,
    passwd=settings.db_pass,
    db=settings.db_name,
    charset="utf8",
    cursorclass=pymysql.cursors.DictCursor,
)
snower commented 6 years ago

just like pymysql, Pass in the parameters

db_pool = tormysql.ConnectionPool(
    max_connections=50,  # max open connections
    idle_seconds=180,  # conntion idle timeout time, 0 is not timeout 连接空闲超过idle_seconds 后会自动关闭回收连接的
    wait_connection_timeout=3,  # wait connection timeout
    host=settings.db_host,
    user=settings.db_user,
    passwd=settings.db_pass,
    db=settings.db_name,
    charset="utf8",
    cursorclass=pymysql.cursors.DictCursor,
    autocommit=True
)
fatpo commented 6 years ago

thx...