MySQLdb compare lower

Anatoli Hristov tolidtm at gmail.com
Tue Dec 11 22:01:18 CET 2012


Hello guys,

Excuse me for the noob question, but is there a way to compare a field
in mysql as lower() somehow?

I have a situation where I compare the SKU in my DB and there are some
SKU that are with lowercase and some with uppercase, how can I solve
this in your opinion ?

def Update_SQL(price, sku):

    db = MySQLdb.connect("localhost","getit","opencart",
use_unicode=True, charset="utf8")
    cursor = db.cursor()
    sql = "UPDATE product SET price=%s WHERE sku=%s"
    cursor.execute(sql, (price, sku))
    db.commit()
    db.close()


Thanks



More information about the Python-list mailing list