CyMySQL 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. cymysql-1.1.1/CyMySQL.egg-info/PKG-INFO +125 -0
  2. cymysql-1.1.1/CyMySQL.egg-info/SOURCES.txt +47 -0
  3. cymysql-1.1.1/CyMySQL.egg-info/dependency_links.txt +1 -0
  4. cymysql-1.1.1/CyMySQL.egg-info/requires.txt +7 -0
  5. cymysql-1.1.1/CyMySQL.egg-info/top_level.txt +1 -0
  6. cymysql-1.1.1/LICENSE +19 -0
  7. cymysql-1.1.1/MANIFEST.in +3 -0
  8. cymysql-1.1.1/PKG-INFO +125 -0
  9. cymysql-1.1.1/README.rst +101 -0
  10. cymysql-1.1.1/cymysql/__init__.py +103 -0
  11. cymysql-1.1.1/cymysql/__version__.py +2 -0
  12. cymysql-1.1.1/cymysql/aio/__init__.py +3 -0
  13. cymysql-1.1.1/cymysql/aio/connections.py +314 -0
  14. cymysql-1.1.1/cymysql/aio/context.py +129 -0
  15. cymysql-1.1.1/cymysql/aio/cursors.py +216 -0
  16. cymysql-1.1.1/cymysql/aio/pool.py +252 -0
  17. cymysql-1.1.1/cymysql/aio/result.py +95 -0
  18. cymysql-1.1.1/cymysql/aio/socketwrapper.py +86 -0
  19. cymysql-1.1.1/cymysql/charset.pxd +18 -0
  20. cymysql-1.1.1/cymysql/charset.py +188 -0
  21. cymysql-1.1.1/cymysql/connections.py +620 -0
  22. cymysql-1.1.1/cymysql/constants/CLIENT.py +37 -0
  23. cymysql-1.1.1/cymysql/constants/COMMAND.py +23 -0
  24. cymysql-1.1.1/cymysql/constants/CR.py +67 -0
  25. cymysql-1.1.1/cymysql/constants/ER.py +1029 -0
  26. cymysql-1.1.1/cymysql/constants/FIELD_TYPE.py +34 -0
  27. cymysql-1.1.1/cymysql/constants/FLAG.py +15 -0
  28. cymysql-1.1.1/cymysql/constants/SERVER_STATUS.py +11 -0
  29. cymysql-1.1.1/cymysql/constants/__init__.py +0 -0
  30. cymysql-1.1.1/cymysql/converters.py +365 -0
  31. cymysql-1.1.1/cymysql/cursors.py +292 -0
  32. cymysql-1.1.1/cymysql/err.py +141 -0
  33. cymysql-1.1.1/cymysql/packet.py +197 -0
  34. cymysql-1.1.1/cymysql/packet.pyx +224 -0
  35. cymysql-1.1.1/cymysql/result.py +107 -0
  36. cymysql-1.1.1/cymysql/result.pyx +117 -0
  37. cymysql-1.1.1/cymysql/socketwrapper.py +92 -0
  38. cymysql-1.1.1/cymysql/socketwrapper.pyx +102 -0
  39. cymysql-1.1.1/cymysql/tests/__init__.py +10 -0
  40. cymysql-1.1.1/cymysql/tests/base.py +23 -0
  41. cymysql-1.1.1/cymysql/tests/test_DictCursor.py +68 -0
  42. cymysql-1.1.1/cymysql/tests/test_async.py +168 -0
  43. cymysql-1.1.1/cymysql/tests/test_basic.py +281 -0
  44. cymysql-1.1.1/cymysql/tests/test_example.py +33 -0
  45. cymysql-1.1.1/cymysql/tests/test_issues.py +309 -0
  46. cymysql-1.1.1/cymysql/times.py +19 -0
  47. cymysql-1.1.1/pyproject.toml +40 -0
  48. cymysql-1.1.1/setup.cfg +4 -0
  49. cymysql-1.1.1/setup.py +29 -0
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: CyMySQL
3
+ Version: 1.1.1
4
+ Summary: Python MySQL Driver using Cython
5
+ Author-email: Yutaka Matsubara <yutaka.matsubara@gmail.com>
6
+ Maintainer-email: Hajime Nakagami <nakagami@gmail.com>
7
+ Project-URL: Project, https://github.com/nakagami/CyMySQL/
8
+ Keywords: MySQL
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Database
14
+ Classifier: Topic :: Database :: Front-Ends
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Description-Content-Type: text/x-rst
17
+ License-File: LICENSE
18
+ Requires-Dist: pycryptodome
19
+ Provides-Extra: zstd
20
+ Requires-Dist: pyzstd; extra == "zstd"
21
+ Provides-Extra: vector
22
+ Requires-Dist: numpy; extra == "vector"
23
+ Dynamic: license-file
24
+
25
+ ========
26
+ CyMySQL
27
+ ========
28
+
29
+ What's CyMySQL
30
+ --------------
31
+
32
+ This package contains a python MySQL client library.
33
+
34
+ It is a fork project from PyMySQL https://pymysql.readthedocs.io/en/latest/.
35
+
36
+ CyMySQL is accerarated by Cython.
37
+
38
+ Documentation on the MySQL client/server protocol can be found here:
39
+ http://dev.mysql.com/doc/internals/en/client-server-protocol.html
40
+
41
+ Requirements
42
+ -------------
43
+
44
+ - Python 3.10+
45
+ - MySQL 5.7 or higher, MariaDB
46
+
47
+ Installation
48
+ --------------
49
+
50
+ With cythonize
51
+
52
+ ::
53
+
54
+ $ pip install cymysql
55
+
56
+ Or without cythonize
57
+
58
+ ::
59
+
60
+ $ NO_CYTHON=1 pip instal cymysql
61
+
62
+ Example
63
+ ---------------
64
+
65
+ Python Database API Specification v2.0
66
+ +++++++++++++++++++++++++++++++++++++++++
67
+
68
+ https://peps.python.org/pep-0249/
69
+
70
+ ::
71
+
72
+ import cymysql
73
+ conn = cymysql.connect(host='127.0.0.1', user='root', passwd='', db='database_name')
74
+ cur = conn.cursor()
75
+ cur.execute('select foo, bar from baz')
76
+ for r in cur.fetchall():
77
+ print(r[0], r[1])
78
+
79
+ asyncio
80
+ ++++++++++++++++++++++++++++++++++++++
81
+
82
+ You can use asyncio to write the following.
83
+
84
+ Use connect
85
+ ::
86
+
87
+ import asyncio
88
+ import cymysql
89
+
90
+ async def conn_example():
91
+ conn = await cymysql.aio.connect(
92
+ host="127.0.0.1",
93
+ user="root",
94
+ passwd="",
95
+ db="database_name",
96
+ )
97
+ cur = conn.cursor()
98
+ await cur.execute("SELECT 42")
99
+ print(await cur.fetchall())
100
+ asyncio.run(conn_example())
101
+
102
+ Use pool
103
+ ::
104
+
105
+ import asyncio
106
+ import cymysql
107
+
108
+ async def pool_example(loop):
109
+ pool = await cymysql.aio.create_pool(
110
+ host="127.0.0.1",
111
+ user="root",
112
+ passwd="",
113
+ db="database_name",
114
+ loop=loop,
115
+ )
116
+ async with pool.acquire() as conn:
117
+ async with conn.cursor() as cur:
118
+ await cur.execute("SELECT 42")
119
+ print(await cur.fetchall())
120
+ pool.close()
121
+ await pool.wait_closed()
122
+
123
+ loop = asyncio.get_event_loop()
124
+ loop.run_until_complete(pool_example(loop))
125
+ loop.close()
@@ -0,0 +1,47 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.rst
4
+ pyproject.toml
5
+ setup.py
6
+ CyMySQL.egg-info/PKG-INFO
7
+ CyMySQL.egg-info/SOURCES.txt
8
+ CyMySQL.egg-info/dependency_links.txt
9
+ CyMySQL.egg-info/requires.txt
10
+ CyMySQL.egg-info/top_level.txt
11
+ cymysql/__init__.py
12
+ cymysql/__version__.py
13
+ cymysql/charset.pxd
14
+ cymysql/charset.py
15
+ cymysql/connections.py
16
+ cymysql/converters.py
17
+ cymysql/cursors.py
18
+ cymysql/err.py
19
+ cymysql/packet.py
20
+ cymysql/packet.pyx
21
+ cymysql/result.py
22
+ cymysql/result.pyx
23
+ cymysql/socketwrapper.py
24
+ cymysql/socketwrapper.pyx
25
+ cymysql/times.py
26
+ cymysql/aio/__init__.py
27
+ cymysql/aio/connections.py
28
+ cymysql/aio/context.py
29
+ cymysql/aio/cursors.py
30
+ cymysql/aio/pool.py
31
+ cymysql/aio/result.py
32
+ cymysql/aio/socketwrapper.py
33
+ cymysql/constants/CLIENT.py
34
+ cymysql/constants/COMMAND.py
35
+ cymysql/constants/CR.py
36
+ cymysql/constants/ER.py
37
+ cymysql/constants/FIELD_TYPE.py
38
+ cymysql/constants/FLAG.py
39
+ cymysql/constants/SERVER_STATUS.py
40
+ cymysql/constants/__init__.py
41
+ cymysql/tests/__init__.py
42
+ cymysql/tests/base.py
43
+ cymysql/tests/test_DictCursor.py
44
+ cymysql/tests/test_async.py
45
+ cymysql/tests/test_basic.py
46
+ cymysql/tests/test_example.py
47
+ cymysql/tests/test_issues.py
@@ -0,0 +1,7 @@
1
+ pycryptodome
2
+
3
+ [vector]
4
+ numpy
5
+
6
+ [zstd]
7
+ pyzstd
@@ -0,0 +1 @@
1
+ cymysql
cymysql-1.1.1/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010-2013 PyMySQL contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.rst LICENSE
2
+ recursive-include cymysql *.pyx *.pxd
3
+ global-exclude *.c
cymysql-1.1.1/PKG-INFO ADDED
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: CyMySQL
3
+ Version: 1.1.1
4
+ Summary: Python MySQL Driver using Cython
5
+ Author-email: Yutaka Matsubara <yutaka.matsubara@gmail.com>
6
+ Maintainer-email: Hajime Nakagami <nakagami@gmail.com>
7
+ Project-URL: Project, https://github.com/nakagami/CyMySQL/
8
+ Keywords: MySQL
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Database
14
+ Classifier: Topic :: Database :: Front-Ends
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Description-Content-Type: text/x-rst
17
+ License-File: LICENSE
18
+ Requires-Dist: pycryptodome
19
+ Provides-Extra: zstd
20
+ Requires-Dist: pyzstd; extra == "zstd"
21
+ Provides-Extra: vector
22
+ Requires-Dist: numpy; extra == "vector"
23
+ Dynamic: license-file
24
+
25
+ ========
26
+ CyMySQL
27
+ ========
28
+
29
+ What's CyMySQL
30
+ --------------
31
+
32
+ This package contains a python MySQL client library.
33
+
34
+ It is a fork project from PyMySQL https://pymysql.readthedocs.io/en/latest/.
35
+
36
+ CyMySQL is accerarated by Cython.
37
+
38
+ Documentation on the MySQL client/server protocol can be found here:
39
+ http://dev.mysql.com/doc/internals/en/client-server-protocol.html
40
+
41
+ Requirements
42
+ -------------
43
+
44
+ - Python 3.10+
45
+ - MySQL 5.7 or higher, MariaDB
46
+
47
+ Installation
48
+ --------------
49
+
50
+ With cythonize
51
+
52
+ ::
53
+
54
+ $ pip install cymysql
55
+
56
+ Or without cythonize
57
+
58
+ ::
59
+
60
+ $ NO_CYTHON=1 pip instal cymysql
61
+
62
+ Example
63
+ ---------------
64
+
65
+ Python Database API Specification v2.0
66
+ +++++++++++++++++++++++++++++++++++++++++
67
+
68
+ https://peps.python.org/pep-0249/
69
+
70
+ ::
71
+
72
+ import cymysql
73
+ conn = cymysql.connect(host='127.0.0.1', user='root', passwd='', db='database_name')
74
+ cur = conn.cursor()
75
+ cur.execute('select foo, bar from baz')
76
+ for r in cur.fetchall():
77
+ print(r[0], r[1])
78
+
79
+ asyncio
80
+ ++++++++++++++++++++++++++++++++++++++
81
+
82
+ You can use asyncio to write the following.
83
+
84
+ Use connect
85
+ ::
86
+
87
+ import asyncio
88
+ import cymysql
89
+
90
+ async def conn_example():
91
+ conn = await cymysql.aio.connect(
92
+ host="127.0.0.1",
93
+ user="root",
94
+ passwd="",
95
+ db="database_name",
96
+ )
97
+ cur = conn.cursor()
98
+ await cur.execute("SELECT 42")
99
+ print(await cur.fetchall())
100
+ asyncio.run(conn_example())
101
+
102
+ Use pool
103
+ ::
104
+
105
+ import asyncio
106
+ import cymysql
107
+
108
+ async def pool_example(loop):
109
+ pool = await cymysql.aio.create_pool(
110
+ host="127.0.0.1",
111
+ user="root",
112
+ passwd="",
113
+ db="database_name",
114
+ loop=loop,
115
+ )
116
+ async with pool.acquire() as conn:
117
+ async with conn.cursor() as cur:
118
+ await cur.execute("SELECT 42")
119
+ print(await cur.fetchall())
120
+ pool.close()
121
+ await pool.wait_closed()
122
+
123
+ loop = asyncio.get_event_loop()
124
+ loop.run_until_complete(pool_example(loop))
125
+ loop.close()
@@ -0,0 +1,101 @@
1
+ ========
2
+ CyMySQL
3
+ ========
4
+
5
+ What's CyMySQL
6
+ --------------
7
+
8
+ This package contains a python MySQL client library.
9
+
10
+ It is a fork project from PyMySQL https://pymysql.readthedocs.io/en/latest/.
11
+
12
+ CyMySQL is accerarated by Cython.
13
+
14
+ Documentation on the MySQL client/server protocol can be found here:
15
+ http://dev.mysql.com/doc/internals/en/client-server-protocol.html
16
+
17
+ Requirements
18
+ -------------
19
+
20
+ - Python 3.10+
21
+ - MySQL 5.7 or higher, MariaDB
22
+
23
+ Installation
24
+ --------------
25
+
26
+ With cythonize
27
+
28
+ ::
29
+
30
+ $ pip install cymysql
31
+
32
+ Or without cythonize
33
+
34
+ ::
35
+
36
+ $ NO_CYTHON=1 pip instal cymysql
37
+
38
+ Example
39
+ ---------------
40
+
41
+ Python Database API Specification v2.0
42
+ +++++++++++++++++++++++++++++++++++++++++
43
+
44
+ https://peps.python.org/pep-0249/
45
+
46
+ ::
47
+
48
+ import cymysql
49
+ conn = cymysql.connect(host='127.0.0.1', user='root', passwd='', db='database_name')
50
+ cur = conn.cursor()
51
+ cur.execute('select foo, bar from baz')
52
+ for r in cur.fetchall():
53
+ print(r[0], r[1])
54
+
55
+ asyncio
56
+ ++++++++++++++++++++++++++++++++++++++
57
+
58
+ You can use asyncio to write the following.
59
+
60
+ Use connect
61
+ ::
62
+
63
+ import asyncio
64
+ import cymysql
65
+
66
+ async def conn_example():
67
+ conn = await cymysql.aio.connect(
68
+ host="127.0.0.1",
69
+ user="root",
70
+ passwd="",
71
+ db="database_name",
72
+ )
73
+ cur = conn.cursor()
74
+ await cur.execute("SELECT 42")
75
+ print(await cur.fetchall())
76
+ asyncio.run(conn_example())
77
+
78
+ Use pool
79
+ ::
80
+
81
+ import asyncio
82
+ import cymysql
83
+
84
+ async def pool_example(loop):
85
+ pool = await cymysql.aio.create_pool(
86
+ host="127.0.0.1",
87
+ user="root",
88
+ passwd="",
89
+ db="database_name",
90
+ loop=loop,
91
+ )
92
+ async with pool.acquire() as conn:
93
+ async with conn.cursor() as cur:
94
+ await cur.execute("SELECT 42")
95
+ print(await cur.fetchall())
96
+ pool.close()
97
+ await pool.wait_closed()
98
+
99
+ loop = asyncio.get_event_loop()
100
+ loop.run_until_complete(pool_example(loop))
101
+ loop.close()
@@ -0,0 +1,103 @@
1
+ '''
2
+ PyMySQL: A pure-Python drop-in replacement for MySQLdb.
3
+
4
+ Copyright (c) 2010-2013 PyMySQL contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
23
+
24
+ '''
25
+ from cymysql import converters
26
+ from cymysql.converters import escape_dict, escape_sequence, escape_string
27
+ from cymysql.err import (
28
+ Warning, Error, InterfaceError, DataError,
29
+ DatabaseError, OperationalError, IntegrityError, InternalError,
30
+ NotSupportedError, ProgrammingError, MySQLError
31
+ )
32
+ from cymysql.times import (
33
+ Date, Time, Timestamp, DateFromTicks, TimeFromTicks, TimestampFromTicks
34
+ )
35
+ from cymysql.connections import Connection
36
+ from cymysql.constants import FIELD_TYPE
37
+ from cymysql import aio
38
+
39
+ from .__version__ import VERSION, __version__
40
+
41
+ threadsafety = 1
42
+ apilevel = "2.0"
43
+ paramstyle = "format"
44
+
45
+
46
+ class DBAPISet(frozenset):
47
+
48
+ def __ne__(self, other):
49
+ if isinstance(other, set):
50
+ return super(DBAPISet, self).__ne__(self, other)
51
+ else:
52
+ return other not in self
53
+
54
+ def __eq__(self, other):
55
+ if isinstance(other, frozenset):
56
+ return frozenset.__eq__(self, other)
57
+ else:
58
+ return other in self
59
+
60
+ def __hash__(self):
61
+ return frozenset.__hash__(self)
62
+
63
+
64
+ STRING = DBAPISet([FIELD_TYPE.ENUM, FIELD_TYPE.STRING, FIELD_TYPE.VAR_STRING])
65
+ BINARY = DBAPISet([
66
+ FIELD_TYPE.BLOB, FIELD_TYPE.LONG_BLOB, FIELD_TYPE.MEDIUM_BLOB, FIELD_TYPE.TINY_BLOB
67
+ ])
68
+ NUMBER = DBAPISet([
69
+ FIELD_TYPE.DECIMAL, FIELD_TYPE.DOUBLE, FIELD_TYPE.FLOAT, FIELD_TYPE.INT24,
70
+ FIELD_TYPE.LONG, FIELD_TYPE.LONGLONG, FIELD_TYPE.TINY, FIELD_TYPE.YEAR
71
+ ])
72
+ DATE = DBAPISet([FIELD_TYPE.DATE, FIELD_TYPE.NEWDATE])
73
+ TIME = DBAPISet([FIELD_TYPE.TIME])
74
+ TIMESTAMP = DBAPISet([FIELD_TYPE.TIMESTAMP, FIELD_TYPE.DATETIME])
75
+ DATETIME = TIMESTAMP
76
+ ROWID = DBAPISet()
77
+
78
+
79
+ def Binary(x):
80
+ """Return x as a binary type."""
81
+ return bytes(x)
82
+
83
+
84
+ def connect(*args, **kwargs):
85
+ conn = Connection(*args, **kwargs)
86
+ conn._connect()
87
+ conn._initialize()
88
+ return conn
89
+
90
+
91
+ NULL = "NULL"
92
+
93
+ __all__ = [
94
+ 'BINARY', 'Binary', 'Connection', 'DATE', 'Date',
95
+ 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 'TimestampFromTicks',
96
+ 'DataError', 'DatabaseError', 'Error', 'FIELD_TYPE', 'IntegrityError',
97
+ 'InterfaceError', 'InternalError', 'MySQLError', 'NULL', 'NUMBER',
98
+ 'NotSupportedError', 'DBAPISet', 'OperationalError', 'ProgrammingError',
99
+ 'ROWID', 'STRING', 'TIME', 'TIMESTAMP', 'Warning', 'apilevel', 'connect',
100
+ 'constants', 'converters', 'cursors', 'escape_dict', 'escape_sequence',
101
+ 'escape_string', 'paramstyle', 'threadsafety', "__version__",
102
+ 'aio',
103
+ ]
@@ -0,0 +1,2 @@
1
+ VERSION = (1, 1, 1)
2
+ __version__ = '%s.%s.%s' % VERSION
@@ -0,0 +1,3 @@
1
+ from .connections import AsyncConnection, connect
2
+ from .pool import create_pool
3
+ from .cursors import AsyncCursor, AsyncDictCursor