Skip to content

decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>] when querying MariaDB 11.4 using mysqlclient #768

@jflabelle81

Description

@jflabelle81

Description

Environment:

  • MariaDB: 11.4
  • Python: 3.9
  • Django: tested with multiple versions (3.x, 4.x and 5.x)
  • mysqlclient: tested with several versions, same issue across all

Issue:
When running Django with the django.db.backends.mysql engine (using mysqlclient), the following error occurs:
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]

Full traceback ends with:
File "/home/.../site-packages/MySQLdb/cursors.py", line 339, in _fetch_row return self._result.fetch_row(size, self._fetch_type) decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]

The same database and schema work immediately and without any change when switching to "pypi mysql-connector-python (with ENGINE = "mysql.connector.django"), and the same project also works on another server running MariaDB 10.6.

No data issues seem to exist in the database, numeric and decimal fields are valid.
Tried adjusting SQL modes (STRICT_TRANS_TABLES, NO_ENGINE_SUBSTITUTION, etc.), column precision, and recreating affected rows, issue persists.

Additional Context:

  • Same codebase and database work properly on MariaDB 10.6 with the same Python and Django setup.
  • This suggests a compatibility issue between mysqlclient and MariaDB 11.4, possibly in the decimal conversion layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions