Skip to content

Commit aa5ec72

Browse files
authored
Merge pull request #6 from dgaidula/hotfix-unixsocket
add support for unix_socket
2 parents a17e59b + cbe3ea0 commit aa5ec72

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pymysqlpool/pool.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Pool(object):
4343
:param port: Port of MySQL server
4444
:param user: User of MySQL server
4545
:param password: Password of MySQL server
46+
:param unix_socket: Optionally, you can use a unix socket rather than TCP/IP.
4647
:param db: Database of MySQL server
4748
:param charset: Charset of MySQL server
4849
:param cursorclass: Class of MySQL Cursor
@@ -62,6 +63,7 @@ def __init__(self,
6263
port=3306,
6364
user=None,
6465
password=None,
66+
unix_socket=None,
6567
db=None,
6668
charset="utf8",
6769
cursorclass=pymysql.cursors.DictCursor,
@@ -99,6 +101,8 @@ def __init__(self,
99101
self.counter = 0
100102
self.accumulation = 0
101103

104+
self.unix_socket=unix_socket
105+
102106
def create_conn(self):
103107
"""Create mysql connection by pymysql and to add unuse_list"""
104108
c = pymysql.connect(
@@ -109,7 +113,8 @@ def create_conn(self):
109113
db=self.db,
110114
charset=self.charset,
111115
cursorclass=self.cursorclass,
112-
autocommit=self.autocommit
116+
autocommit=self.autocommit,
117+
unix_socket=self.unix_socket
113118
)
114119
self.unuse_list.add(c)
115120

0 commit comments

Comments
 (0)