> Den 19. dec. 2015 kl. 07.52 skrev Cristiano Coelho <[email protected]>: > > Hello, > > After django 1.8, the mysql backend no longer strips microseconds. > This is giving me some issues when upgrading from 1.7 (I actually upgraded to > 1.9 directly), since date times are not stored with micro second precision on > mysql, but the queries are sent with them. > As I see it, my only option is to update all existing date time columns of > all existing tables, which is quite boring since there are many tables. > Is there a way I can explicitly set the model datetime precision? Will this > work with raw queries also? Could this be a global setting or monkey patch? > This new behaviour basically breaks any '=' query on date times, at least raw > queries (I haven't tested the others) since it sends micro seconds which are > not stripped down.
MySQL as of version 5.6.4 (and MariaDB) is able to store microseconds in datetime fields, but you need to set the precision when you create the column. In Django, this should "just work". Which version of MySQL are you using, and are your columns created as DATETIME(6)? Erik -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/8BB7E576-385E-41D7-B0AB-CBF4DB17ED36%40cederstrand.dk. For more options, visit https://groups.google.com/d/optout.
