Hi All,

 my question is linked to this thread, so I post here

I need to run sql query with LIKE and % in the end - I have tried %%
and %%%%:
CLASSNAME.objects.raw("select * from table where full_name like %s%%
", [user_input])
this is what I get as sql:
select * from table where full_name LIKE 'user_input'%

I would like to use raw() method as it nicely maps data to model.

Is there a way to append % to parameter so that LIKE works as
startswith?
or can I somehow securely escape input to use with format string?

PS. I need object.raw(). I learned about djangoish way - but
unfortunately it is not enough - I need raw sql

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to