#10070: Named parameters not working on raw sql queries with sqlite
-------------------------------------+-------------------------------------
     Reporter:  Matias Surdi         |                    Owner:  Ryan
                                     |  Cheley
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 I agree with Shai that we should avoid using regex here.

 The most straightforward solution I can think of, I haven't looked at the
 Oracle implementation in details, would be to simply implement
 `__getitem__`

 {{{#!python
  class SQLiteParams:
     def __getitem__(self, param):
         return f":{param}"

 sql = sql % SQLiteParams()
 }}}

 This will ensure the backend reports the low level ''missing param''
 message in cases a parameter is missing instead of a `KeyError` during the
 Django ''translation'' phase

-- 
Ticket URL: <https://code.djangoproject.com/ticket/10070#comment:29>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701842a41a611-625d4020-a806-46cc-b92d-0e2f61803a52-000000%40eu-central-1.amazonses.com.

Reply via email to