mysqlclient 2.2.8__tar.gz → 2.3.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.
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/HISTORY.rst +68 -0
- {mysqlclient-2.2.8/src/mysqlclient.egg-info → mysqlclient-2.3.1}/PKG-INFO +1 -1
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/doc/user_guide.rst +47 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/pyproject.toml +1 -1
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/setup.py +14 -15
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/__init__.py +35 -34
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/_mysql.c +491 -165
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/connections.py +51 -30
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/constants/ER.py +1 -2
- mysqlclient-2.3.1/src/MySQLdb/constants/__init__.py +1 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/converters.py +10 -8
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/cursors.py +235 -56
- mysqlclient-2.3.1/src/MySQLdb/release.py +3 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/times.py +17 -5
- {mysqlclient-2.2.8 → mysqlclient-2.3.1/src/mysqlclient.egg-info}/PKG-INFO +1 -1
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/mysqlclient.egg-info/SOURCES.txt +2 -1
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/tests/capabilities.py +10 -8
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/tests/configdb.py +4 -4
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/tests/dbapi20.py +15 -16
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/tests/test_MySQLdb_capabilities.py +22 -18
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/tests/test_MySQLdb_dbapi20.py +9 -9
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/tests/test_MySQLdb_nonstandard.py +4 -3
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/tests/test_MySQLdb_times.py +11 -5
- mysqlclient-2.3.1/tests/test__mysql.py +36 -0
- mysqlclient-2.3.1/tests/test_connection.py +153 -0
- mysqlclient-2.3.1/tests/test_cursor.py +801 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/tests/test_errors.py +1 -1
- mysqlclient-2.3.1/tests/test_sqlalchemy.py +151 -0
- mysqlclient-2.2.8/src/MySQLdb/constants/__init__.py +0 -1
- mysqlclient-2.2.8/src/MySQLdb/release.py +0 -3
- mysqlclient-2.2.8/tests/test__mysql.py +0 -7
- mysqlclient-2.2.8/tests/test_connection.py +0 -26
- mysqlclient-2.2.8/tests/test_cursor.py +0 -245
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/LICENSE +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/MANIFEST.in +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/README.md +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/doc/FAQ.rst +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/doc/MySQLdb.constants.rst +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/doc/MySQLdb.rst +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/doc/conf.py +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/doc/index.rst +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/setup.cfg +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/site.cfg +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/_exceptions.py +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/constants/CLIENT.py +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/constants/CR.py +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/constants/FIELD_TYPE.py +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/MySQLdb/constants/FLAG.py +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/mysqlclient.egg-info/dependency_links.txt +0 -0
- {mysqlclient-2.2.8 → mysqlclient-2.3.1}/src/mysqlclient.egg-info/top_level.txt +0 -0
|
@@ -1,3 +1,71 @@
|
|
|
1
|
+
======================
|
|
2
|
+
What's new in 2.3.1
|
|
3
|
+
======================
|
|
4
|
+
|
|
5
|
+
Release: 2026-11-10
|
|
6
|
+
|
|
7
|
+
* **Security fix:** Escape Python ``set`` query parameters using the connection's
|
|
8
|
+
character set and SQL mode. This fixes SQL injection when
|
|
9
|
+
``NO_BACKSLASH_ESCAPES`` is enabled and an attacker controls a set member.
|
|
10
|
+
``frozenset`` parameters now use the same escaping.
|
|
11
|
+
See `GHSA-m9c3-99x3-77g6 <https://github.com/PyMySQL/mysqlclient/security/advisories/GHSA-m9c3-99x3-77g6>`_.
|
|
12
|
+
|
|
13
|
+
* Deprecate ``MySQLdb.converters.Set2Str``.
|
|
14
|
+
|
|
15
|
+
* ``Connection.literal()`` now applies built-in handling only to exact built-in
|
|
16
|
+
types. Subclasses use the connection's converter mapping.
|
|
17
|
+
|
|
18
|
+
* Fix crashes when looking up connection attributes with a non-string name or
|
|
19
|
+
a string containing lone surrogates. (#810)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
======================
|
|
23
|
+
What's new in 2.3.0
|
|
24
|
+
======================
|
|
25
|
+
|
|
26
|
+
Release: 2026-09-07
|
|
27
|
+
|
|
28
|
+
* Concurrent use of the same Connection object from multiple threads now
|
|
29
|
+
raises ``ProgrammingError`` immediately instead of causing undefined
|
|
30
|
+
behavior.
|
|
31
|
+
Applications should use separate connections for concurrent operations.
|
|
32
|
+
(#781)
|
|
33
|
+
|
|
34
|
+
* Add an optional ``executemany_fallback="multi"`` connection option.
|
|
35
|
+
When enabled, ``Cursor.executemany()`` can batch eligible INSERT, REPLACE,
|
|
36
|
+
UPDATE, and DELETE statements into multi-statement queries instead of
|
|
37
|
+
executing them one at a time. This can significantly improve performance of
|
|
38
|
+
operations such as SQLAlchemy bulk UPDATEs. The default remains "loop",
|
|
39
|
+
and the existing multi-row INSERT/REPLACE optimization is unchanged. (#798)
|
|
40
|
+
|
|
41
|
+
* Add ``Cursor.warning_count`` to expose the warning count for the last
|
|
42
|
+
statement. (#780)
|
|
43
|
+
|
|
44
|
+
* Make ``Cursor`` itself an iterator as specified by DB-API 2.0.
|
|
45
|
+
``iter(cursor) is cursor`` and ``next(cursor)`` fetches the next row. (#785)
|
|
46
|
+
|
|
47
|
+
* Quote stored procedure names and user variable names in ``Cursor.callproc()``,
|
|
48
|
+
allowing names containing reserved words or special characters. (#789)
|
|
49
|
+
|
|
50
|
+
* Fix conversion of ``datetime.timedelta`` values to support microseconds and
|
|
51
|
+
negative values correctly. (#795)
|
|
52
|
+
|
|
53
|
+
* Add Windows ARM64 wheels. (#796)
|
|
54
|
+
|
|
55
|
+
* Test with Python 3.15 and free-threaded Python 3.15, and update the MariaDB
|
|
56
|
+
Connector/C used for Windows wheels to 3.4.9. (#797)
|
|
57
|
+
|
|
58
|
+
* Add ``Connection.more_results()`` for checking whether additional results
|
|
59
|
+
remain after a multi-statement query. (#798)
|
|
60
|
+
|
|
61
|
+
* Deprecate accessing exception classes such as ``ProgrammingError`` and
|
|
62
|
+
``OperationalError`` as ``Cursor`` attributes. Access them from the
|
|
63
|
+
``MySQLdb`` package instead. (#782)
|
|
64
|
+
|
|
65
|
+
* Deprecate the ``reconnect`` parameter of ``Connection.ping()``. Calling
|
|
66
|
+
``ping()`` without the parameter is unchanged. (#790)
|
|
67
|
+
|
|
68
|
+
|
|
1
69
|
======================
|
|
2
70
|
What's new in 2.2.8
|
|
3
71
|
======================
|
|
@@ -72,6 +72,7 @@ MySQL C API function mapping
|
|
|
72
72
|
``mysql_get_server_info()`` ``conn.get_server_info()``
|
|
73
73
|
``mysql_info()`` ``conn.info()``
|
|
74
74
|
``mysql_insert_id()`` ``conn.insert_id()``
|
|
75
|
+
``mysql_more_results()`` ``conn.more_results()``
|
|
75
76
|
``mysql_num_fields()`` ``result.num_fields()``
|
|
76
77
|
``mysql_num_rows()`` ``result.num_rows()``
|
|
77
78
|
``mysql_options()`` various options to ``_mysql.connect()``
|
|
@@ -321,6 +322,27 @@ connect(parameters...)
|
|
|
321
322
|
overridden. Default: ``MySQLdb.cursors.Cursor``. *This
|
|
322
323
|
must be a keyword parameter.*
|
|
323
324
|
|
|
325
|
+
executemany_fallback
|
|
326
|
+
Controls how ``Cursor.executemany()`` handles statements that
|
|
327
|
+
cannot use the multi-row INSERT/REPLACE optimization. ``"loop"``
|
|
328
|
+
executes the statements one at a time and is the default.
|
|
329
|
+
``"multi"`` may combine safe data manipulation statements into a
|
|
330
|
+
multi-statement query. If multi-statements are disabled or a query
|
|
331
|
+
is not eligible, execution silently falls back to ``"loop"``.
|
|
332
|
+
|
|
333
|
+
This is a connection option so it can be passed through, for
|
|
334
|
+
example, SQLAlchemy's ``connect_args`` or Django's database
|
|
335
|
+
``OPTIONS``::
|
|
336
|
+
|
|
337
|
+
create_engine(
|
|
338
|
+
"mysql+mysqldb://user:password@host/database",
|
|
339
|
+
connect_args={"executemany_fallback": "multi"},
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
DATABASES["default"]["OPTIONS"]["executemany_fallback"] = "multi"
|
|
343
|
+
|
|
344
|
+
See ``executemany()`` below for batching and transaction details.
|
|
345
|
+
|
|
324
346
|
use_unicode
|
|
325
347
|
If True, CHAR and VARCHAR and TEXT columns are returned as
|
|
326
348
|
Unicode strings, using the configured character set. It is
|
|
@@ -562,6 +584,31 @@ close()
|
|
|
562
584
|
close the cursor when you are done with it and before creating a
|
|
563
585
|
new one.
|
|
564
586
|
|
|
587
|
+
executemany(operation, seq_of_params)
|
|
588
|
+
Executes an operation for every parameter set and returns the total
|
|
589
|
+
number of affected rows. Multi-row INSERT and REPLACE statements use
|
|
590
|
+
MySQLdb's existing single-statement ``VALUES`` rewrite whenever it
|
|
591
|
+
applies, independently of ``executemany_fallback``.
|
|
592
|
+
|
|
593
|
+
With ``executemany_fallback="multi"``, statements that do not match that
|
|
594
|
+
rewrite may instead be sent in multi-statement batches. This applies only
|
|
595
|
+
to SQL templates which begin with INSERT, REPLACE, UPDATE, or DELETE
|
|
596
|
+
(ignoring leading whitespace), contain no semicolon, and contain no
|
|
597
|
+
``RETURNING`` clause. Other statements, including statements beginning
|
|
598
|
+
with a comment or ``WITH``, use the normal loop. The loop is also used
|
|
599
|
+
silently when the connection does not have multi-statements enabled.
|
|
600
|
+
|
|
601
|
+
Each batch is limited to 16000 encoded bytes, including separators, and
|
|
602
|
+
200 statements. A single rendered statement exceeding the byte limit is
|
|
603
|
+
executed alone. On successful completion, ``rowcount`` and the return
|
|
604
|
+
value are the sum of the affected-row counts for all statements.
|
|
605
|
+
|
|
606
|
+
Batching does not create an implicit transaction and is not atomic. If a
|
|
607
|
+
statement fails, statements before it may already have executed, while
|
|
608
|
+
statements after it do not execute. Applications needing all-or-nothing
|
|
609
|
+
behavior must manage a transaction explicitly; with autocommit enabled,
|
|
610
|
+
each statement may be committed independently.
|
|
611
|
+
|
|
565
612
|
info()
|
|
566
613
|
Returns some information about the last query. Normally
|
|
567
614
|
you don't need to check this. If there are any MySQL
|
|
@@ -35,7 +35,7 @@ Project = "https://github.com/PyMySQL/mysqlclient"
|
|
|
35
35
|
Documentation = "https://mysqlclient.readthedocs.io/"
|
|
36
36
|
|
|
37
37
|
[build-system]
|
|
38
|
-
requires = ["setuptools>=
|
|
38
|
+
requires = ["setuptools>=77"]
|
|
39
39
|
build-backend = "setuptools.build_meta"
|
|
40
40
|
|
|
41
41
|
[tool.setuptools]
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import os
|
|
3
3
|
import subprocess
|
|
4
4
|
import sys
|
|
5
|
-
|
|
6
|
-
import setuptools
|
|
7
5
|
from configparser import ConfigParser
|
|
8
6
|
|
|
7
|
+
import setuptools
|
|
9
8
|
|
|
10
9
|
release_info = {}
|
|
11
10
|
with open("src/MySQLdb/release.py", encoding="utf-8") as f:
|
|
@@ -70,11 +69,11 @@ def get_config_posix(options=None):
|
|
|
70
69
|
("__version__", release_info["__version__"]),
|
|
71
70
|
]
|
|
72
71
|
|
|
73
|
-
ext_options =
|
|
74
|
-
extra_compile_args
|
|
75
|
-
extra_link_args
|
|
76
|
-
define_macros
|
|
77
|
-
|
|
72
|
+
ext_options = {
|
|
73
|
+
"extra_compile_args": cflags,
|
|
74
|
+
"extra_link_args": ldflags,
|
|
75
|
+
"define_macros": define_macros,
|
|
76
|
+
}
|
|
78
77
|
# newer versions of gcc require libstdc++ if doing a static build
|
|
79
78
|
if static:
|
|
80
79
|
ext_options["language"] = "c++"
|
|
@@ -120,14 +119,14 @@ def get_config_win32(options):
|
|
|
120
119
|
("__version__", release_info["__version__"]),
|
|
121
120
|
]
|
|
122
121
|
|
|
123
|
-
ext_options =
|
|
124
|
-
library_dirs
|
|
125
|
-
libraries
|
|
126
|
-
extra_link_args
|
|
127
|
-
include_dirs
|
|
128
|
-
extra_objects
|
|
129
|
-
define_macros
|
|
130
|
-
|
|
122
|
+
ext_options = {
|
|
123
|
+
"library_dirs": library_dirs,
|
|
124
|
+
"libraries": libraries,
|
|
125
|
+
"extra_link_args": extra_link_args,
|
|
126
|
+
"include_dirs": include_dirs,
|
|
127
|
+
"extra_objects": extra_objects,
|
|
128
|
+
"define_macros": define_macros,
|
|
129
|
+
}
|
|
131
130
|
return ext_options
|
|
132
131
|
|
|
133
132
|
|
|
@@ -13,8 +13,8 @@ For information on how MySQLdb handles type conversion, see the
|
|
|
13
13
|
MySQLdb.converters module.
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
|
-
from .release import version_info
|
|
17
16
|
from . import _mysql
|
|
17
|
+
from .release import version_info
|
|
18
18
|
|
|
19
19
|
if version_info != _mysql.version_info:
|
|
20
20
|
raise ImportError(
|
|
@@ -24,32 +24,33 @@ if version_info != _mysql.version_info:
|
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
from ._mysql import (
|
|
28
|
-
NotSupportedError,
|
|
29
|
-
OperationalError,
|
|
30
|
-
get_client_info,
|
|
31
|
-
ProgrammingError,
|
|
32
|
-
Error,
|
|
33
|
-
InterfaceError,
|
|
34
|
-
debug,
|
|
35
|
-
IntegrityError,
|
|
36
|
-
string_literal,
|
|
37
|
-
MySQLError,
|
|
38
|
-
DataError,
|
|
39
|
-
DatabaseError,
|
|
40
|
-
InternalError,
|
|
41
|
-
Warning,
|
|
42
|
-
)
|
|
43
27
|
from MySQLdb.constants import FIELD_TYPE
|
|
44
28
|
from MySQLdb.times import (
|
|
45
29
|
Date,
|
|
46
|
-
Time,
|
|
47
|
-
Timestamp,
|
|
48
30
|
DateFromTicks,
|
|
31
|
+
Time,
|
|
49
32
|
TimeFromTicks,
|
|
33
|
+
Timestamp,
|
|
50
34
|
TimestampFromTicks,
|
|
51
35
|
)
|
|
52
36
|
|
|
37
|
+
from ._mysql import (
|
|
38
|
+
DatabaseError,
|
|
39
|
+
DataError,
|
|
40
|
+
Error,
|
|
41
|
+
IntegrityError,
|
|
42
|
+
InterfaceError,
|
|
43
|
+
InternalError,
|
|
44
|
+
MySQLError,
|
|
45
|
+
NotSupportedError,
|
|
46
|
+
OperationalError,
|
|
47
|
+
ProgrammingError,
|
|
48
|
+
Warning,
|
|
49
|
+
debug,
|
|
50
|
+
get_client_info,
|
|
51
|
+
string_literal,
|
|
52
|
+
)
|
|
53
|
+
|
|
53
54
|
threadsafety = 1
|
|
54
55
|
apilevel = "2.0"
|
|
55
56
|
paramstyle = "format"
|
|
@@ -95,7 +96,7 @@ ROWID = DBAPISet()
|
|
|
95
96
|
|
|
96
97
|
|
|
97
98
|
def test_DBAPISet_set_equality():
|
|
98
|
-
assert STRING == STRING
|
|
99
|
+
assert STRING == STRING # noqa
|
|
99
100
|
|
|
100
101
|
|
|
101
102
|
def test_DBAPISet_set_inequality():
|
|
@@ -125,33 +126,33 @@ connect = Connection = Connect
|
|
|
125
126
|
|
|
126
127
|
__all__ = [
|
|
127
128
|
"BINARY",
|
|
129
|
+
"DATE",
|
|
130
|
+
"FIELD_TYPE",
|
|
131
|
+
"NUMBER",
|
|
132
|
+
"ROWID",
|
|
133
|
+
"STRING",
|
|
134
|
+
"TIME",
|
|
135
|
+
"TIMESTAMP",
|
|
128
136
|
"Binary",
|
|
129
137
|
"Connect",
|
|
130
138
|
"Connection",
|
|
131
|
-
"
|
|
132
|
-
"Date",
|
|
133
|
-
"Time",
|
|
134
|
-
"Timestamp",
|
|
135
|
-
"DateFromTicks",
|
|
136
|
-
"TimeFromTicks",
|
|
137
|
-
"TimestampFromTicks",
|
|
139
|
+
"DBAPISet",
|
|
138
140
|
"DataError",
|
|
139
141
|
"DatabaseError",
|
|
142
|
+
"Date",
|
|
143
|
+
"DateFromTicks",
|
|
140
144
|
"Error",
|
|
141
|
-
"FIELD_TYPE",
|
|
142
145
|
"IntegrityError",
|
|
143
146
|
"InterfaceError",
|
|
144
147
|
"InternalError",
|
|
145
148
|
"MySQLError",
|
|
146
|
-
"NUMBER",
|
|
147
149
|
"NotSupportedError",
|
|
148
|
-
"DBAPISet",
|
|
149
150
|
"OperationalError",
|
|
150
151
|
"ProgrammingError",
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
152
|
+
"Time",
|
|
153
|
+
"TimeFromTicks",
|
|
154
|
+
"Timestamp",
|
|
155
|
+
"TimestampFromTicks",
|
|
155
156
|
"Warning",
|
|
156
157
|
"apilevel",
|
|
157
158
|
"connect",
|