On the method of POOLEDDB using autocommit

Source: Internet
Author: User

In Python, the normal use of the database, you can call connection in the Autocommit function to set whether to turn on Automatic Updates


self._db = MySQLdb.connect (**self._db_args) self._db.autocommit (True)

However, if the thread pool pooleddb is used, it cannot be set using the connection returned by the thread pool, but is set when the thread pool is created

Self.__pool = Pooleddb (Creator=mysqldb, mincached=1, maxcached=20, Host=dbhost, Port=dbport, User=DBUSER, Passwd=DBPWD , db=dbname,use_unicode=false,charset=dbchar,cursorclass=dictcursor,setsession=[' SET AUTOCOMMIT = 1 '])

One of the

setsession=[' SET autocommit = 1 ']

is used to set whether the thread pool turns on automatic update configuration, 0 is false,1 true

This article is from the "Shadow of the Moon, shadow of the Sea" blog, please be sure to keep this source http://abyss.blog.51cto.com/3625755/1736844

On the method of POOLEDDB using autocommit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.