[Fixed]-Django: Using named parameters on a raw SQL query

10👍

edit:

The format needs to have s suffix as following:

%(u_email)s

2👍

If you are using SQLite3, for some reason syntax %(name)s will not work.
You have to use :name syntax instead if you want to pass your params as {"name":"value"} dictionary.

It’s contrary to the documentation, that states the first syntax should work with all DB engines.

Heres the source of the issue:
https://code.djangoproject.com/ticket/10070#comment:18

Leave a comment