Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Members / jhb / python sql notes

python sql notes

by Jörg Baach last modified Jun 30, 2011 04:39 PM
thinks to remember when working with python, mysql and maybe sqlalchemy

Passing bind parameters to like

c.execute("select * from brands where brandname like %%%s%%",('ooba',))

(to find 'Foobar') won't work in all its variations.

What will work:

c.execute("select * from brands where brandname like %s",("%%%s%%" % "ooba"))

 

Add comment

You can add a comment by filling out the form below. Plain text formatting.

Question: What is 6 times 7?
Your answer: