Friday, December 23, 2011

Re: Compare two tables in a secondary database

On Thu, Dec 22, 2011 at 11:33 PM, Edvinas Narbutas <enarbutas@gmail.com> wrote:
I get this error. "not enough arguments for format string", which im
guessing the LIKE isnt working because this query works.


No, LIKE is working fine, it's your Python string that's broken.

item_search_results = itemSearch.objects.raw(
       '''SELECT * FROM invTypes WHERE invTypes.typeName LIKE '%s%'
LIMIT 0, 10''', [search_query]
).using(

I recommend rereading the Python docs on string formatting[1].


Cheers,
AT

[1] http://docs.python.org/library/stdtypes.html#string-formatting-operations

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

No comments:

Post a Comment