Re: difference in datetime aggregation when using sqlite3 instead of mysql
Using sqlite for dev is common practive, don't worry, it is not naive to do it.
I remember seeing somehing about contenttypes and sqlite, I'm too hungry to remember now, maybe someone else in the list can give a better input than me.
on the query result just do a if DEBUG or if DEVELOPMENT or if backend==sqlite or if returned type == string then create a datetime object from the string.
On Sat, Oct 26, 2013 at 9:47 PM, Wesley George <wesley.george@gmail.com> wrote:
I'm working on a django application that uses the mysql backend in production but the sqlite3 db backend during dev to speed up testing.--I was surprised to find these backends differ when populating extra model fields with aggregated datetimes. Specifically, if you use Queryset.extra to create a field that is a maximum of some datetime objects, the sqlite django backend makes this field a string, while the mysql backend makes this field a datetime object. I've put a minimal django app at github (here) that exemplifies this difference on my setup, Django 1.5.1, python 2.7.4, Ubuntu 13.04.I know there are situations where these backends will behave differently, I took the above aggregation operation to be basic enough that this shouldn't be such a situation. The django docs on database backends note an old bug concerning date aggregation with sqlite in windows, but I didn't think this should apply.I'd love to hear from some other Django users. For example,
- Is this behaviour expected?
- (was I naive in subbing the sqlite backend in during development?)
- Is this a known bug?
- Is there a better way to use django's ORM to accomplish what I'm doing?
- (e.g. create a full-fledged DateTime field on the model, that must be kept up to date when the other table is updated).
All comments appreciated!Wes
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/205179bf-a853-424a-9a8e-8b3297ab856c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6tL2oALzmL1PsWW90OU3BKFeQZ2Qmyr1fWyNbzbFVYNGmw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home