vendredi 24 avril 2015

Python SQLite how do you do partial searches using '?' placeholders?

Say that my query looks like this:

q = SELECT * FROM MY_TABLE WHERE FIELD LIKE ?
cursor.execute(q, some_query_value)

This doesn't seem to be doing a "contains" search, so instead I tried doing this

q = SELECT * FROM MY_TABLE WHERE FIELD LIKE %?%
cursor.execute(q, some_query_value)

But python didn't seem to like this. What's the proper way of doing it?

Aucun commentaire:

Enregistrer un commentaire