It is disgusting to use SQLite in multiple threads.

Source: Internet
Author: User
Never imagined that the SQLite module had a problem in multithreading and could only be used by the thread that created the SQLite connection. Other Threads could not be used at all! Otherwise, an error is reported, which is disgusting. Now it seems that the only way is to create a connection in each thread, and each thread operates the database on its own. The connection in each thread can be created in advance by using the connection pool or re-established during each operation.
From this point of view, when using an embedded database in Python, we must consider concurrency and multithreading. SQLite is not very good in this regard. The remaining option is to either use the bsddb module without the SQL language, or use metakit or Firebird.
Metakit seems to be a good database module with good performance, but I have never used it.
Firebird is a good database. Previously, Borland's Interbase was an open-source product that barely worked with MySQL and PostgreSQL as the three open-source databases. Firebird also supports embedding, and can easily switch data from embedding to the database server mode. Python uses the Firebird module kinterbasdb, which can be found in SourceForge. This should be good.
Related Article

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.