Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#32732 closed Cleanup/optimization (fixed)

MySQL backend uses deprecated "db" and "passwd" kwargs.

Reported by: gopackgo90 Owned by: Nick Pope
Component: Database layer (models, ORM) Version: 3.2
Severity: Normal Keywords: mysql
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The "db" and "passwd" usage can be seen at https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/db/backends/mysql/base.py#L202-L205 in main. mysqlclient recently marked these two kwargs as deprecated (see https://github.com/PyMySQL/mysqlclient/commit/fa25358d0f171bd8a63729c5a8d76528f4ae74e9) in favor of "database" and "password" respectively. mysqlclient added support for "database" and "password" in 1.3.8 with https://github.com/PyMySQL/mysqlclient/commit/66029d64060fca03f3d0b22661b1b4cf9849ef03.

Django 2.2, 3.1, and 3.2 all require a minimum version of mysqlclient newer than 1.3.8, so a fix for this could be backported to all currently supported versions of Django.

Change History (6)

comment:1 Changed 5 months ago by Mariusz Felisiak

Easy pickings: set
Keywords: mysql added
Summary: MySQL Client Uses Deprecated "db" and "passwd" kwargsMySQL backend uses deprecated "db" and "passwd" kwargs.
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization
Version: dev3.2

Thanks for this report.

Django 2.2, 3.1, and 3.2 all require a minimum version of mysqlclient newer than 1.3.8, so a fix for this could be backported to all currently supported versions of Django.

Django 2.2 and 3.1 are in extended support so they don't receive bugfixes anymore (except security patches). We'll document the maximum supported version of mysqlclient in these versions as soon as deprecated kwargs are removed.

IMO we can backport this to the Django 3.2 since it's LTS.

comment:2 Changed 5 months ago by Nick Pope

Has patch: set
Owner: changed from nobody to Nick Pope
Status: newassigned

comment:3 Changed 5 months ago by Mariusz Felisiak

Patch needs improvement: set

comment:4 Changed 5 months ago by Nick Pope

Patch needs improvement: unset

comment:5 Changed 5 months ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In 1061f52:

Fixed #32732 -- Removed usage of deprecated 'db' and 'passwd' connection options in MySQL backend.

The 'db' and 'passwd' connection options have been deprecated, use
'database' and 'password' instead (available since mysqlclient >= 1.3.8).

This also allows the 'database' option in DATABASESOPTIONS? on MySQL.

comment:6 Changed 5 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In 4318e60a:

[3.2.x] Fixed #32732 -- Removed usage of deprecated 'db' and 'passwd' connection options in MySQL backend.

The 'db' and 'passwd' connection options have been deprecated, use
'database' and 'password' instead (available since mysqlclient >= 1.3.8).

This also allows the 'database' option in DATABASESOPTIONS? on MySQL.

Backport of 1061f5243646b4c9b8a758f8a36c9e2ccdded1cf from main

Note: See TracTickets for help on using tickets.
Back to Top