#10070: Named parameters not working on raw sql queries with sqlite
-------------------------------------+-------------------------------------
Reporter: Matias Surdi | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(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 Baptiste Mispelon):
I don't know how recent it is, but sqlite does support named parameters,
albeit with a different syntax [1].
Both of these work on my machine:
{{{
#!python
c.execute("select name from inventory_host where id=:id", {'id': '1'})
Host.objects.raw("select * from inventory_host where id=:id", {'id': '1'})
}}}
Do we want to try and make the syntax consistent across all backends or
would it be enough to document the syntax for each one?
[1] https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.execute
--
Ticket URL: <https://code.djangoproject.com/ticket/10070#comment:18>
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/064.e03be1639e7ea7aa3d57ad0f739fc766%40djangoproject.com.