parametrizing a sqlite query

Sebastian Bassi sbassi at clubdelarazon.org
Wed Feb 24 12:07:07 EST 2010


c.execute("SELECT bin FROM bins WHERE qtl LIKE '%:keys%'",{'keys':keywords})

This query returns empty. When it is executed, keywords = 'harvest'.
To check it, I do it on the command line and it works as expected:

sqlite> SELECT bin FROM bins WHERE qtl LIKE '%harvest%';
11C
11D
12F

I guess there is a problem with the "%".



More information about the Python-list mailing list