@@ -10,6 +10,7 @@ Table of content
10
10
- [ Requirements] ( https://github.com/zongzhenh/PyMySQLPool/blob/master/README.md#requirements )
11
11
- [ Installation] ( https://github.com/zongzhenh/PyMySQLPool/blob/master/README.md#installation )
12
12
- [ Example] ( https://github.com/zongzhenh/PyMySQLPool/blob/master/README.md#example )
13
+ - [ Parameters] ( https://github.com/zongzhenh/PyMySQLPool/blob/master/README.md#parameters )
13
14
- [ Roadmap] ( https://github.com/zongzhenh/PyMySQLPool/blob/master/README.md#roadmap )
14
15
- [ Resources] ( https://github.com/zongzhenh/PyMySQLPool/blob/master/README.md#resources )
15
16
- [ License] ( https://github.com/zongzhenh/PyMySQLPool/blob/master/README.md#license )
@@ -49,20 +50,19 @@ mysql> CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
49
50
- > species VARCHAR (20 ), sex CHAR (1 ), birth DATE , death DATE );
50
51
51
52
mysql> INSERT INTO pet
52
- - > VALUES (' Puffball' , ' Diane' , ' hamster' , ' f ' , ' 1999-03-30' , NULL );
53
+ - > VALUES (" Puffball" , " Diane" , " hamster" , " f " , " 1999-03-30" , NULL );
53
54
```
54
55
55
56
``` python
56
57
from pymysqlpool.pool import Pool
57
58
58
59
59
- pool = Pool(host = ' YOUR_HOST' , port = ' YOUR_PORT' , user = ' YOUR_USER' , password = ' YOUR_PASSWORD' ,
60
- db = ' YOUR_DB' , min_size = 10 , max_size = 90 )
60
+ pool = Pool(host = HOST , port = PORT , user = USER , password = PASSWORD , db = DB )
61
61
pool.init()
62
62
63
63
connection = pool.get_conn()
64
64
cur = connection.cursor()
65
- cur.execute(' SELECT * FROM `pet` WHERE `name`=%s ' , args = (' Puffball' , ))
65
+ cur.execute(' SELECT * FROM `pet` WHERE `name`=%s ' , args = (" Puffball" , ))
66
66
print (cur.fetchone())
67
67
68
68
pool.release(connection)
@@ -74,16 +74,41 @@ This example will print:
74
74
('Puffball', 'Diane', 'hamster', 'f', datetime.date(1999, 3, 30), None)
75
75
```
76
76
77
+ Support auto-commit mode, as following:
78
+
79
+ ``` python
80
+ pool = Pool(host = HOST , port = PORT , user = USER , password = PASSWORD , db = DB , autocommit = True )
81
+ ```
82
+
77
83
That's all.
78
84
85
+ ## Parameters for the pool initial:
86
+
87
+ ` host ` : Host of MySQL server
88
+ ` port ` : Port of MySQL server
89
+ ` user ` : User of MySQL server
90
+ ` password ` : Password of MySQL server
91
+ ` db ` : Database of MySQL server
92
+ ` charset ` : Charset of MySQL server
93
+ ` cursorclass ` : Class of MySQL Cursor
94
+ ` autocommit ` : auto commit mode
95
+ ` min_size ` : Minimum size of connection pool
96
+ ` max_size ` : Maximum size of connection pool
97
+ ` timeout ` : Watting time in the multi-thread environment
98
+ ` interval ` : Statistical cycle time
99
+ ` stati_mun ` : Statistical frequency
100
+ ` multiple ` : Regulation standard
101
+ ` counter ` : Counter
102
+ ` accumulation ` : Statiscal result
103
+
79
104
## Roadmap
80
105
81
106
+ [x] Connection Pool
82
107
+ [x] Dynamically Create
83
108
+ [x] Dynamically Release
84
109
+ [ ] Monitor Web Interface
85
110
86
- ### Resources
111
+ ## Resources
87
112
88
113
- [ PyMySQL Documenation] ( https://pymysql.readthedocs.io/en/latest/index.html )
89
114
- [ MySQL Reference Manuals] ( https://dev.mysql.com/doc/refman/8.0/en/ )
0 commit comments