Hi guys.

im new in this forum, getting used to python+turbogears and already have a doubt.

i have a sql statement to do , that uses "like" . for example:

sql = db.text("select name from users where name like '%Fernando%' and dt_birthday='%s'" %(dt_birthday))

and the server gives me the following error:

TypeError: not enough arguments for format string

and didnt took long to realize that he is messing with my '%Fernando%' because he uses % to format the string ( %s).

There is anyway to fix that? workaround? i really need to use it. any tip or help will be well acepted !! thanks in advance !!!

please.. somebody?!!?

i found a workaround for it.. or the solution itself? dont now...

thats what i did, for example:
sql = "select name from user where date_birthday = '%s' " %(dt_birth)
sql += " and name like '%%Fernando%%' "
rs = db.execute(db.text(sql)).fetchall()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.