I execute rawsql within a django app (pgsql 9.6 backend) like so:
obj=AddModel.objects.raw("""
SELECT * FROM "codeaddmodel" \
WHERE ("codeaddmodel"."data" -> 'CodeData') \
@> '[{"street": "New Street" }]'
""")
and it works brilliantly.
Now, I do the following, as per the django doc, and use params:
term="New Street"
obj=AddModel.objects.raw("""
SELECT * FROM "codeaddmodel" \
WHERE ("codeaddmodel"."data" -> 'CodeData') \
@> '[{"street": %s }]'
""",[term])
and this throws the error:
django.db.utils.ProgrammingError: syntax error at or near "New"
I have tried for around two hours and google has failed me!
%sin"":..{"street": "%s" }..