python sql passer des parametres dans une requet pymysql

Solutions on MaxInterview for python sql passer des parametres dans une requet pymysql by the best coders in the world

showing results for - "python sql passer des parametres dans une requet pymysql"
Simone
22 Feb 2016
1# Connect to db
2# Open a cursor
3stmt = "SELECT * FROM users WHERE username = %(user)s"
4cursor.execute(stmt, {"user": "bob"})
5user = cursor.fetchone()
6print user
7
8{"username": "bob", "alias": "bobby", "avatar": "default", "fullname": "bob"}
9
similar questions