Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

python sql passer des parametres dans une requet pymysql

# Connect to db
# Open a cursor
stmt = "SELECT * FROM users WHERE username = %(user)s"
cursor.execute(stmt, {"user": "bob"})
user = cursor.fetchone()
print user

{"username": "bob", "alias": "bobby", "avatar": "default", "fullname": "bob"}
Source by living-sun.com #
 
PREVIOUS NEXT
Tagged: #python #sql #passer #des #parametres #dans #une #requet #pymysql
ADD COMMENT
Topic
Name
2+4 =