logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

escaping wildcards: msg#00003

Subject: escaping wildcards
This is a very basic question, but I am just stuck and googling doesn't helps.

Given a nice little query:
SELECT *, lastname || ', ' || firstname || ' ' || middlename as name
FROM users
WHERE ((firstname LIKE %%(firstname)s%) OR (middlename LIKE %%(middlename)s%) OR (lastname LIKE %%(lastname)s%))
 ORDER BY name asc LIMIT 20 OFFSET 0

and a parameters dictionary:
{'middlename': 'ksenia', 'lastname': 'ksenia', 'firstname': 'ksenia'}

the following code
cursor.execute(sql, params)

produces the following error:
TypeError: unindexable object

I tried quotes... extra percentage signs... but never get desirable results. What am I doing wrong? I am also guilty on using an old psycopg version: 1.1.13. Just in case it matters.

Appreciate any help,
Ksenia.


<Prev in Thread] Current Thread [Next in Thread>