Bug #90541 | Django with Mysql 8.0 datatime incompatible | ||
---|---|---|---|
Submitted: | 20 Apr 2018 21:04 | Modified: | 25 Jun 2018 21:25 |
Reporter: | Marcelo Wanderley Delta | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / Python | Severity: | S2 (Serious) |
Version: | 8.0.11 | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[20 Apr 2018 21:04]
Marcelo Wanderley Delta
[20 Apr 2018 21:04]
Marcelo Wanderley Delta
AttributeError at /admin/login/ > >'datetime.datetime' object has no > attribute 'split' > >Request Method: > >POST Request > URL: http://localhost:8000/admin/login/?next=/admin/ > Django > Version: 2.0.4 > >Exception Type: AttributeError Exception Value: > 'datetime.datetime' object has no attribute 'split' > >Exception > Location: /usr/local/lib/python3.6/site-packages/mysql/connector/conversion.py > in _DATETIME_to_python, line 506 Python > > >Executable: /usr/local/bin/python Python Version: 3.6.5
[23 Apr 2018 13:30]
Chiranjeevi Battula
Hello Marcelo, Thank you for the bug report. I could not repeat the issue at our end using with Connector / Python 8.0.11 with MySQL 8.0.11 version. Could you please provide repeatable steps (exact steps/sample code, stack trace etc. - please make it as private if you prefer) to confirm this issue at our end? Thanks, Chiranjeevi.
[24 Apr 2018 8:26]
Oli Jo
traceback error
Attachment: mysql_bug_report-24042018.txt (text/plain), 7.88 KiB.
[24 Apr 2018 8:29]
Oli Jo
Hello, I encounter the same issue, here is my config, traceback error detailled above. virtualenvwrapper->python3.5 mysql version 14.14 Distrib 5.7.21, for Linux (x86_64) Installing local env Connector/Python from Source mysql-connector-python-8.0.11 Cordialement Olivier J.
[1 May 2018 9:51]
Daniel Thorell
Simple test case to trigger the error, tested on Ubuntu 16.04: python3.5 -m venv venv source venv/bin/activate pip install django==1.11.12 mysql-connector-python==8.0.11 django-admin startproject mysql_test cd mysql_test vi mysql_test/settings.py Change: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } TO: DATABASES = { 'default': { 'ENGINE': 'mysql.connector.django', 'NAME': 'dev', 'USER': 'dev', 'PASSWORD': 'dev', 'HOST': '127.0.0.1', 'OPTIONS': { 'autocommit': True, 'raise_on_warnings': False } } } Migrate the Database: python manage.py migrate Create superuser: python manage.py createsuperuser Run dev server: python manage.py runserver In webbrowser enter url: http://127.0.0.1:8000/admin Login with superuser just created, Will not work due to: 'datetime.datetime' object has no attribute 'split' Exception Location: mysql/connector/conversion.py in _DATETIME_to_python, line 506 Installed versions: Django==1.11.12 mysql-connector-python==8.0.11 pkg-resources==0.0.0 protobuf==3.5.2.post1 pytz==2018.4 six==1.11.0 Using MySQL-community 8.0.11
[3 May 2018 11:43]
Chiranjeevi Battula
Hello Marcelo, Thank you for feedback. Verified this behavior on MySQL Connector/Python 8.0.11 with the help of dev's. Thanks, Chiranjeevi.
[3 May 2018 14:01]
Nuno Mariz
This happens when using the C extension, which is enabled by default. It will work by setting `use_pure=True` in DATABASES['default']['OPTIONS'].
[11 Jun 2018 10:52]
Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=91197 marked as duplicate of this one.
[25 Jun 2018 21:25]
Philip Olson
Posted by developer: Fixed as of the upcoming MySQL Connector/Python 8.0.12 release, and here's the changelog entry: Fixed datetime conversion compatibility between Django 2.0 and MySQL 8.0. A workaround is to use the connector's pure Python implementation instead the C extension by setting "use_pure=True" in Django's database options. Thank you for the bug report.