Tuesday, November 14, 2017

Are time zone definitions actually required/used in MySQL?

For MySQL the Django docs say:

If you plan on using Django's timezone support, use mysql_tzinfo_to_sql to load time zone tables into the MySQL database. This needs to be done just once for your MySQL server, not per database.

I can't find any evidence that Django actually uses those tables?

Here, for example, is a snippet from adapt_datetimefield_value():

        # MySQL doesn't support tz-aware datetimes
        if timezone.is_aware(value):
            if settings.USE_TZ:
                value = timezone.make_naive(value, self.connection.timezone)
            else:
                raise ValueError("MySQL backend does not support timezone-aware datetimes when USE_TZ is False.")

adapt_timefiled_value() is even simpler:

        # MySQL doesn't support tz-aware times
        if timezone.is_aware(value):
            raise ValueError("MySQL backend does not support timezone-aware times.")

What am I missing? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a3584f88-bd35-44b2-a5aa-2da201c50ae3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment