All Projects → prprprus → PyMySQLPool

prprprus / PyMySQLPool

Licence: MIT license
PyMySQL-based database connection pool.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to PyMySQLPool

Flexy Pool
FlexyPool adds metrics and failover strategies to a given Connection Pool, allowing it to resize on demand.
Stars: ✭ 856 (+1546.15%)
Mutual labels:  connection-pool
Smproxy
Swoole MySQL Proxy 一个基于 MySQL 协议,Swoole 开发的MySQL数据库连接池。 A MySQL database connection pool based on MySQL protocol and Swoole.
Stars: ✭ 1,665 (+3101.92%)
Mutual labels:  connection-pool
Go Conntrack
Go middleware for net.Conn tracking (Prometheus/trace)
Stars: ✭ 197 (+278.85%)
Mutual labels:  connection-pool
Chrome Pool
Headless chrome tabs manage pool
Stars: ✭ 40 (-23.08%)
Mutual labels:  connection-pool
Pool
General Purpose Connection Pool for GRPC,RPC,TCP Sevice Cluster
Stars: ✭ 98 (+88.46%)
Mutual labels:  connection-pool
Beecp
A High Performance JDBC Connection Pool
Stars: ✭ 131 (+151.92%)
Mutual labels:  connection-pool
Libfastcommon
c common functions library extracted from my open source project FastDFS. this library is very simple and stable. functions including: string, logger, chain, hash, socket, ini file reader, base64 encode / decode, url encode / decode, fast timer, skiplist, object pool etc. detail info please see the c header files.
Stars: ✭ 739 (+1321.15%)
Mutual labels:  connection-pool
web-ui
python+selenium+pytest+allure UI 自动化框架
Stars: ✭ 199 (+282.69%)
Mutual labels:  pymysql
Apns
apns is a simple golang package for ios notification based http2 protocol
Stars: ✭ 100 (+92.31%)
Mutual labels:  connection-pool
Connection Pool
A common connection pool based on Swoole is usually used as a database connection pool.
Stars: ✭ 164 (+215.38%)
Mutual labels:  connection-pool
Gopool
go连接池、Golang连接池、By Golang realize distributed common connection pool.
Stars: ✭ 60 (+15.38%)
Mutual labels:  connection-pool
Pymysql Pool
A simple but robust connection pool (with multiplexing) base on PyMySQL, mainly used for multi threads mode, which also compatible with single thread mode.
Stars: ✭ 93 (+78.85%)
Mutual labels:  connection-pool
Mobc
A generic connection pool for Rust with async/await support
Stars: ✭ 141 (+171.15%)
Mutual labels:  connection-pool
Pgpool
A PosgreSQL client that automatically uses connection pools and handles reconnections in case of errors.
Stars: ✭ 38 (-26.92%)
Mutual labels:  connection-pool
Dbutils
Database connections for multi-threaded environments
Stars: ✭ 212 (+307.69%)
Mutual labels:  connection-pool
Nexer
Content based network multiplexer or redirector made with love and Go
Stars: ✭ 7 (-86.54%)
Mutual labels:  connection-pool
Ycdatabase
The lightest php database framework written in c language, built in php extension, for mysql
Stars: ✭ 130 (+150%)
Mutual labels:  connection-pool
honeycomb
A database connection pool that no one dares to use
Stars: ✭ 35 (-32.69%)
Mutual labels:  connection-pool
Hikaricp
光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Stars: ✭ 16,146 (+30950%)
Mutual labels:  connection-pool
R2dbc Pool
Connection Pooling for Reactive Relational Database Connectivity
Stars: ✭ 141 (+171.15%)
Mutual labels:  connection-pool

PyMySQLPool

build status codecov pip version license

PyMySQLPool is a pymysql-based database connection pool, simple and lightweight.

Table of content

Features

  • Maintain a minimum number of connection pools by default.
  • If a number of unuse connections less than zero, dynamically add connections to pool until the current number of inuse connections equal maximum of the pool.
  • Release the idle connections in regular until a number of unuse connections equal minimum of the pool.
  • Support auto-commit mode.
  • Support for ping check to get healthy connections.

Requirements

  • Python
    • CPython : >= 3.4
  • MySQL Server -- one of the following:
    • MySQL >= 5.5
    • MariaDB >= 5.5
  • PyMySQL: >= 0.9.2

Installation

Package is uploaded on PyPI

You can install with pip

$ pip install pymysql-pooling

Example

Make use of a simple table (Example in MySQL doc)

mysql> CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
    -> species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);

mysql> INSERT INTO pet
    -> VALUES ("Puffball", "Diane", "hamster", "f", "1999-03-30", NULL);
from pymysqlpool.pool import Pool


# Note: you can also add any parameters relates to `pymysql.connections.Connection` object
pool = Pool(host=HOST, port=PORT, user=USER, password=PASSWORD, db=DB)
pool.init()

connection = pool.get_conn()
cur = connection.cursor()
cur.execute('SELECT * FROM `pet` WHERE `name`=%s', args=("Puffball", ))
print(cur.fetchone())

pool.release(connection)

This example will print:

('Puffball', 'Diane', 'hamster', 'f', datetime.date(1999, 3, 30), None)

Support autocommit mode, as following:

pool = Pool(host=HOST, port=PORT, user=USER, password=PASSWORD, db=DB, autocommit=True)

That's all.

Roadmap

  • Connection Pool
  • Dynamically Create
  • Dynamically Release
  • Monitor Web Interface

Resources

License

PyMySQLPool is released under the MIT License. See LICENSE for more information.

Contributing

Thank you for your interest in the contribution of PyMySQLPool, your help and contribution is very valuable.

You can submit an issue and pull requests, please submit an issue before submitting pull requests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].