Support microsecond precision in MySQL ORM DateTimeField
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
MariaDB, and MySQL 5.6, support sub-second precision in DATETIME fields (see https://kb.askmonty.org/en/microseconds-in-mariadb/).
Ideally, the ORM should support storing and retrieving datetime() with microsecond precision and creating DATETIME(n) columns.
I tested a models.DateTimeField() field backed by DATETIME(3) on MariaDB, but unfortunately the field on the Django model instance is always None even though the database contains a valid date.
Change History (21)
comment:1 Changed 4 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|