mysqlclient 2.2.5__tar.gz → 2.2.7__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.5 → mysqlclient-2.2.7}/HISTORY.rst +22 -0
- {mysqlclient-2.2.5/src/mysqlclient.egg-info → mysqlclient-2.2.7}/PKG-INFO +2 -2
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/doc/user_guide.rst +4 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/pyproject.toml +0 -1
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/setup.py +1 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/_mysql.c +52 -29
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/connections.py +21 -2
- mysqlclient-2.2.7/src/MySQLdb/release.py +3 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7/src/mysqlclient.egg-info}/PKG-INFO +2 -2
- mysqlclient-2.2.5/src/MySQLdb/release.py +0 -3
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/LICENSE +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/MANIFEST.in +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/README.md +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/doc/FAQ.rst +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/doc/MySQLdb.constants.rst +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/doc/MySQLdb.rst +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/doc/conf.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/doc/index.rst +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/setup.cfg +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/site.cfg +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/__init__.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/_exceptions.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/constants/CLIENT.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/constants/CR.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/constants/ER.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/constants/FIELD_TYPE.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/constants/FLAG.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/constants/__init__.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/converters.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/cursors.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/MySQLdb/times.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/mysqlclient.egg-info/SOURCES.txt +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/mysqlclient.egg-info/dependency_links.txt +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/src/mysqlclient.egg-info/top_level.txt +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/capabilities.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/configdb.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/dbapi20.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/test_MySQLdb_capabilities.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/test_MySQLdb_dbapi20.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/test_MySQLdb_nonstandard.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/test_MySQLdb_times.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/test__mysql.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/test_connection.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/test_cursor.py +0 -0
- {mysqlclient-2.2.5 → mysqlclient-2.2.7}/tests/test_errors.py +0 -0
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
======================
|
|
2
|
+
What's new in 2.2.7
|
|
3
|
+
======================
|
|
4
|
+
|
|
5
|
+
Release: 2025-01-10
|
|
6
|
+
|
|
7
|
+
* Add ``user``, ``host``, ``database``, and ``db`` attributes to ``Connection``.
|
|
8
|
+
opentelemetry-instrumentation-(dbapi|mysqlclient) use them. (#753)
|
|
9
|
+
|
|
10
|
+
======================
|
|
11
|
+
What's new in 2.2.6
|
|
12
|
+
======================
|
|
13
|
+
|
|
14
|
+
Release: 2024-11-12
|
|
15
|
+
|
|
16
|
+
* MariaDB Connector/C 3.4 and MairaDB 11.4 enabled SSL and CA verification by default.
|
|
17
|
+
It affected 2.2.5 windows wheel. This release disables SSL and CA verification by default. (#731)
|
|
18
|
+
|
|
19
|
+
* Add ``server_public_key_path`` option. It is needed to connect MySQL server with
|
|
20
|
+
``sha256_password`` or ``caching_sha2_password`` authentication plugin without
|
|
21
|
+
secure connection. (#744)
|
|
22
|
+
|
|
1
23
|
======================
|
|
2
24
|
What's new in 2.2.5
|
|
3
25
|
======================
|
|
@@ -393,6 +393,10 @@ connect(parameters...)
|
|
|
393
393
|
an exception is raised. *This must be a keyword
|
|
394
394
|
parameter.*
|
|
395
395
|
|
|
396
|
+
server_public_key_path
|
|
397
|
+
specifies path to a RSA public key used by caching sha2 password authentication.
|
|
398
|
+
See https://dev.mysql.com/doc/refman/9.0/en/caching-sha2-pluggable-authentication.html
|
|
399
|
+
|
|
396
400
|
.. _mysql_ssl_set: http://dev.mysql.com/doc/refman/en/mysql-ssl-set.html
|
|
397
401
|
|
|
398
402
|
|
|
@@ -36,13 +36,18 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
36
36
|
#endif
|
|
37
37
|
|
|
38
38
|
#if ((MYSQL_VERSION_ID >= 50555 && MYSQL_VERSION_ID <= 50599) || \
|
|
39
|
-
(MYSQL_VERSION_ID >= 50636 && MYSQL_VERSION_ID <= 50699) || \
|
|
40
|
-
(MYSQL_VERSION_ID >= 50711 && MYSQL_VERSION_ID <= 50799) || \
|
|
41
|
-
(MYSQL_VERSION_ID >= 80000)) && \
|
|
42
|
-
!defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID)
|
|
39
|
+
(MYSQL_VERSION_ID >= 50636 && MYSQL_VERSION_ID <= 50699) || \
|
|
40
|
+
(MYSQL_VERSION_ID >= 50711 && MYSQL_VERSION_ID <= 50799) || \
|
|
41
|
+
(MYSQL_VERSION_ID >= 80000)) && \
|
|
42
|
+
!defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID)
|
|
43
43
|
#define HAVE_ENUM_MYSQL_OPT_SSL_MODE
|
|
44
44
|
#endif
|
|
45
45
|
|
|
46
|
+
#if defined(MARIADB_VERSION_ID) && MARIADB_VERSION_ID >= 100403 || \
|
|
47
|
+
!defined(MARIADB_VERSION_ID) && MYSQL_VERSION_ID >= 50723
|
|
48
|
+
#define HAVE_MYSQL_SERVER_PUBLIC_KEY
|
|
49
|
+
#endif
|
|
50
|
+
|
|
46
51
|
#define PY_SSIZE_T_CLEAN 1
|
|
47
52
|
#include "Python.h"
|
|
48
53
|
|
|
@@ -431,7 +436,7 @@ _mysql_ConnectionObject_Initialize(
|
|
|
431
436
|
"client_flag", "ssl", "ssl_mode",
|
|
432
437
|
"local_infile",
|
|
433
438
|
"read_timeout", "write_timeout", "charset",
|
|
434
|
-
"auth_plugin",
|
|
439
|
+
"auth_plugin", "server_public_key_path",
|
|
435
440
|
NULL } ;
|
|
436
441
|
int connect_timeout = 0;
|
|
437
442
|
int read_timeout = 0;
|
|
@@ -442,14 +447,15 @@ _mysql_ConnectionObject_Initialize(
|
|
|
442
447
|
*read_default_file=NULL,
|
|
443
448
|
*read_default_group=NULL,
|
|
444
449
|
*charset=NULL,
|
|
445
|
-
*auth_plugin=NULL
|
|
450
|
+
*auth_plugin=NULL,
|
|
451
|
+
*server_public_key_path=NULL;
|
|
446
452
|
|
|
447
453
|
self->converter = NULL;
|
|
448
454
|
self->open = false;
|
|
449
455
|
self->reconnect = false;
|
|
450
456
|
|
|
451
457
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
|
452
|
-
"|
|
|
458
|
+
"|ssssisOiiisssiOsiiisss:connect",
|
|
453
459
|
kwlist,
|
|
454
460
|
&host, &user, &passwd, &db,
|
|
455
461
|
&port, &unix_socket, &conv,
|
|
@@ -462,10 +468,19 @@ _mysql_ConnectionObject_Initialize(
|
|
|
462
468
|
&read_timeout,
|
|
463
469
|
&write_timeout,
|
|
464
470
|
&charset,
|
|
465
|
-
&auth_plugin
|
|
471
|
+
&auth_plugin,
|
|
472
|
+
&server_public_key_path
|
|
466
473
|
))
|
|
467
474
|
return -1;
|
|
468
475
|
|
|
476
|
+
#ifndef HAVE_MYSQL_SERVER_PUBLIC_KEY
|
|
477
|
+
if (server_public_key_path) {
|
|
478
|
+
PyErr_SetString(_mysql_NotSupportedError, "server_public_key_path is not supported");
|
|
479
|
+
return -1;
|
|
480
|
+
}
|
|
481
|
+
#endif
|
|
482
|
+
// For compatibility with PyPy, we need to keep strong reference
|
|
483
|
+
// to unicode objects until we use UTF8.
|
|
469
484
|
#define _stringsuck(d,t,s) {t=PyMapping_GetItemString(s,#d);\
|
|
470
485
|
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
|
|
471
486
|
PyErr_Clear();}
|
|
@@ -542,24 +557,35 @@ _mysql_ConnectionObject_Initialize(
|
|
|
542
557
|
mysql_options(&(self->connection), MYSQL_OPT_SSL_CAPATH, capath);
|
|
543
558
|
mysql_options(&(self->connection), MYSQL_OPT_SSL_CIPHER, cipher);
|
|
544
559
|
}
|
|
560
|
+
for (int i=0 ; i<n_ssl_keepref; i++) {
|
|
561
|
+
Py_DECREF(ssl_keepref[i]);
|
|
562
|
+
ssl_keepref[i] = NULL;
|
|
563
|
+
}
|
|
545
564
|
|
|
546
|
-
if (ssl_mode_set) {
|
|
547
565
|
#ifdef HAVE_ENUM_MYSQL_OPT_SSL_MODE
|
|
566
|
+
if (ssl_mode_set) {
|
|
548
567
|
mysql_options(&(self->connection), MYSQL_OPT_SSL_MODE, &ssl_mode_num);
|
|
568
|
+
}
|
|
549
569
|
#else
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
570
|
+
// MariaDB doesn't support MYSQL_OPT_SSL_MODE.
|
|
571
|
+
// See https://github.com/PyMySQL/mysqlclient/issues/474
|
|
572
|
+
// And MariDB 11.4 changed the default value of MYSQL_OPT_SSL_ENFORCE and
|
|
573
|
+
// MYSQL_OPT_SSL_VERIFY_SERVER_CERT to 1.
|
|
574
|
+
// https://github.com/mariadb-corporation/mariadb-connector-c/commit/8dffd56936df3d03eeccf47904773860a0cdeb57
|
|
575
|
+
// We emulate the ssl_mode and old behavior.
|
|
576
|
+
my_bool my_true = 1;
|
|
577
|
+
my_bool my_false = 0;
|
|
578
|
+
if (ssl_mode_num >= SSLMODE_REQUIRED) {
|
|
579
|
+
mysql_options(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&my_true);
|
|
580
|
+
} else {
|
|
581
|
+
mysql_options(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&my_false);
|
|
582
|
+
}
|
|
583
|
+
if (ssl_mode_num >= SSLMODE_VERIFY_CA) {
|
|
584
|
+
mysql_options(&(self->connection), MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (void *)&my_true);
|
|
585
|
+
} else {
|
|
586
|
+
mysql_options(&(self->connection), MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (void *)&my_false);
|
|
562
587
|
}
|
|
588
|
+
#endif
|
|
563
589
|
|
|
564
590
|
if (charset) {
|
|
565
591
|
mysql_options(&(self->connection), MYSQL_SET_CHARSET_NAME, charset);
|
|
@@ -567,20 +593,17 @@ _mysql_ConnectionObject_Initialize(
|
|
|
567
593
|
if (auth_plugin) {
|
|
568
594
|
mysql_options(&(self->connection), MYSQL_DEFAULT_AUTH, auth_plugin);
|
|
569
595
|
}
|
|
596
|
+
#ifdef HAVE_MYSQL_SERVER_PUBLIC_KEY
|
|
597
|
+
if (server_public_key_path) {
|
|
598
|
+
mysql_options(&(self->connection), MYSQL_SERVER_PUBLIC_KEY, server_public_key_path);
|
|
599
|
+
}
|
|
600
|
+
#endif
|
|
570
601
|
|
|
571
602
|
Py_BEGIN_ALLOW_THREADS
|
|
572
603
|
conn = mysql_real_connect(&(self->connection), host, user, passwd, db,
|
|
573
604
|
port, unix_socket, client_flag);
|
|
574
605
|
Py_END_ALLOW_THREADS
|
|
575
606
|
|
|
576
|
-
if (ssl) {
|
|
577
|
-
int i;
|
|
578
|
-
for (i=0; i<n_ssl_keepref; i++) {
|
|
579
|
-
Py_DECREF(ssl_keepref[i]);
|
|
580
|
-
ssl_keepref[i] = NULL;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
607
|
if (!conn) {
|
|
585
608
|
_mysql_Exception(self);
|
|
586
609
|
return -1;
|
|
@@ -137,6 +137,10 @@ class Connection(_mysql.connection):
|
|
|
137
137
|
Since mysqlclient 2.2.4, ssl=True is alias of ssl_mode=REQUIRED
|
|
138
138
|
for better compatibility with PyMySQL and MariaDB.
|
|
139
139
|
|
|
140
|
+
:param str server_public_key_path:
|
|
141
|
+
specify the path to a file RSA public key file for caching_sha2_password.
|
|
142
|
+
See https://dev.mysql.com/doc/refman/9.0/en/caching-sha2-pluggable-authentication.html
|
|
143
|
+
|
|
140
144
|
:param bool local_infile:
|
|
141
145
|
enables LOAD LOCAL INFILE; zero disables
|
|
142
146
|
|
|
@@ -192,18 +196,18 @@ class Connection(_mysql.connection):
|
|
|
192
196
|
# PEP-249 requires autocommit to be initially off
|
|
193
197
|
autocommit = kwargs2.pop("autocommit", False)
|
|
194
198
|
|
|
199
|
+
self._set_attributes(*args, **kwargs2)
|
|
195
200
|
super().__init__(*args, **kwargs2)
|
|
201
|
+
|
|
196
202
|
self.cursorclass = cursorclass
|
|
197
203
|
self.encoders = {
|
|
198
204
|
k: v
|
|
199
205
|
for k, v in conv.items()
|
|
200
206
|
if type(k) is not int # noqa: E721
|
|
201
207
|
}
|
|
202
|
-
|
|
203
208
|
self._server_version = tuple(
|
|
204
209
|
[numeric_part(n) for n in self.get_server_info().split(".")[:2]]
|
|
205
210
|
)
|
|
206
|
-
|
|
207
211
|
self.encoding = "ascii" # overridden in set_character_set()
|
|
208
212
|
|
|
209
213
|
if not charset:
|
|
@@ -234,6 +238,21 @@ class Connection(_mysql.connection):
|
|
|
234
238
|
self.autocommit(autocommit)
|
|
235
239
|
self.messages = []
|
|
236
240
|
|
|
241
|
+
def _set_attributes(self, host=None, user=None, password=None, database="", port=3306,
|
|
242
|
+
unix_socket=None, **kwargs):
|
|
243
|
+
"""set some attributes for otel"""
|
|
244
|
+
if unix_socket and not host:
|
|
245
|
+
host = "localhost"
|
|
246
|
+
# support opentelemetry-instrumentation-dbapi
|
|
247
|
+
self.host = host
|
|
248
|
+
# _mysql.Connection provides self.port
|
|
249
|
+
self.user = user
|
|
250
|
+
self.database = database
|
|
251
|
+
# otel-inst-mysqlclient uses db instead of database.
|
|
252
|
+
self.db = database
|
|
253
|
+
# NOTE: We have not supported semantic conventions yet.
|
|
254
|
+
# https://opentelemetry.io/docs/specs/semconv/database/sql/
|
|
255
|
+
|
|
237
256
|
def __enter__(self):
|
|
238
257
|
return self
|
|
239
258
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|