id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 6922 "querying DateTimeFields using the ""in"" query fails under sqlite" mhalle@… nobody "When using the ""in"" query with a DateTimeField (in this case, DateField) with the SQLite backend, Django throws a TypeError. It doesn't matter whether the argument is a string or a datetime object. The same field can successfully be queried with the ""range"" query. I didn't have time to look at the offending library code completely, but the problem appears to be a tuple vs. string/string character bug. {{{ Traceback (most recent call last): File ""querytst.py"", line 14, in print Complaint.objects.filter(incident_date__in=[datetime(2008, 2, 14)]).count() File ""/Library/Python/2.5/site-packages/django/db/models/query.py"", line 243, in count cursor.execute(""SELECT COUNT(*)"" + sql, params) File ""/Library/Python/2.5/site-packages/django/db/backends/util.py"", line 21, in execute sql = self.db.ops.last_executed_query(self.cursor, sql, params) File ""/Library/Python/2.5/site-packages/django/db/backends/__init__.py"", line 150, in last_executed_query return smart_unicode(sql) % u_params TypeError: not all arguments converted during string formatting }}} " closed Database layer (models, ORM) dev duplicate DateTimeField, in, SQLite Unreviewed 0 0 0 0 0 0