#25287: Multiplying and dividing connectors are not supported by sqlite backed.
-------------------------------------+-------------------------------------
     Reporter:  javrasya             |      Owner:  nobody
         Type:  Bug                  |     Status:  new
    Component:  Database layer       |    Version:  1.8
  (models, ORM)                      |   Keywords:  sqlite3,
     Severity:  Normal               |  combine_duration_expression, F
                                     |  expressions,
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+-------------------------------------
 I have a query using F expressions. When I run this query on PostgreSQL it
 works. But in tests with '''sqlite3''', it does not work;


 Here is my complex query.
 {{{
 expires = Expire.objects.filter(ticket__date_opened__lte=(datetime.now() -
 F("action__percent") * F("action__rule__duration") / 100))
 }}}

 Sqlite backend does not support connector *. When I looked into the code,
 it only supports + and - connectors.

 {{{
 DatabaseError: Invalid connector for timedelta: *.
 }}}


 {{{
     def combine_duration_expression(self, connector, sub_expressions):
         if connector not in ['+', '-']:
             raise utils.DatabaseError('Invalid connector for timedelta:
 %s.' % connector)
         fn_params = ["'%s'" % connector] + sub_expressions
         if len(fn_params) > 3:
             raise ValueError('Too many params for timedelta operations.')
         return "django_format_dtdelta(%s)" % ', '.join(fn_params)
 }}}


 I tried to add * and / operator in the list; no problem occured. I think
 this should be fixed simply.

--
Ticket URL: <https://code.djangoproject.com/ticket/25287>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.1eb5abddd0015babe0ffa096c970f58e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to