Skip to content

Commit 2d36a19

Browse files
authored
Remove warning for db and passwd. (PyMySQL#940)
* update doc * Remove warning.
1 parent 0acaa7f commit 2d36a19

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

docs/source/user/examples.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ This example will print:
5656

5757
.. code:: python
5858
59-
{'password': 'very-secret', 'id': 1}
59+
{'id': 1, 'password': 'very-secret'}

pymysql/connections.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ class Connection:
135135
:param ssl_verify_cert: Set to true to check the validity of server certificates
136136
:param ssl_verify_identity: Set to true to check the server's identity
137137
:param read_default_group: Group to read from in the configuration file.
138-
:param compress: Not supported
139-
:param named_pipe: Not supported
140138
:param autocommit: Autocommit mode. None means use server default. (default: False)
141139
:param local_infile: Boolean to enable the use of LOAD DATA LOCAL command. (default: False)
142140
:param max_allowed_packet: Max size of packet sent to server in bytes. (default: 16MB)
@@ -149,9 +147,11 @@ class Connection:
149147
an argument. For the dialog plugin, a prompt(echo, prompt) method can be used
150148
(if no authenticate method) for returning a string from the user. (experimental)
151149
:param server_public_key: SHA256 authentication plugin public key value. (default: None)
152-
:param db: Alias for database. (for compatibility to MySQLdb)
153-
:param passwd: Alias for password. (for compatibility to MySQLdb)
154150
:param binary_prefix: Add _binary prefix on bytes and bytearray. (default: False)
151+
:param compress: Not supported
152+
:param named_pipe: Not supported
153+
:param db: **DEPRECATED** Alias for database.
154+
:param passwd: **DEPRECATED** Alias for password.
155155
156156
See `Connection <https://www.python.org/dev/peps/pep-0249/#connection-objects>`_ in the
157157
specification.
@@ -205,12 +205,16 @@ def __init__(
205205
db=None, # deprecated
206206
):
207207
if db is not None and database is None:
208-
warnings.warn("'db' is deprecated, use 'database'", DeprecationWarning, 3)
208+
# We will raise warining in 2022 or later.
209+
# See https://github.com/PyMySQL/PyMySQL/issues/939
210+
# warnings.warn("'db' is deprecated, use 'database'", DeprecationWarning, 3)
209211
database = db
210212
if passwd is not None and not password:
211-
warnings.warn(
212-
"'passwd' is deprecated, use 'password'", DeprecationWarning, 3
213-
)
213+
# We will raise warining in 2022 or later.
214+
# See https://github.com/PyMySQL/PyMySQL/issues/939
215+
# warnings.warn(
216+
# "'passwd' is deprecated, use 'password'", DeprecationWarning, 3
217+
# )
214218
password = passwd
215219

216220
if compress or named_pipe:

0 commit comments

Comments
 (0)