I can't reproduce the problem with the following test case (please review):
def main(): cnx = mysql.connector.connect(database='test') cur = cnx.cursor() cur.execute('DROP TABLE IF EXISTS t1') cur.execute("CREATE TABLE t1 (id INT NOT NULL, c1 VARCHAR(30), c2 INT)") cur.execute("REPLACE INTO t1 VALUES (%s,%s,%s)", (1,'ham%s',2)) cur.execute("SELECT * FROM t1") print(cur.fetchall()) cnx.close()
The result is:
[(1, 'ham%s', 2)]
I can't reproduce the problem with the following test case (please review):
def main(): .connect( database= 'test') execute( 'DROP TABLE IF EXISTS t1') execute( "CREATE TABLE t1 (id INT NOT NULL, c1 VARCHAR(30), c2 INT)") execute( "REPLACE INTO t1 VALUES (%s,%s,%s)", (1,'ham%s',2)) execute( "SELECT * FROM t1") cur.fetchall( ))
cnx = mysql.connector
cur = cnx.cursor()
cur.
cur.
cur.
cur.
print(
cnx.close()
The result is:
[(1, 'ham%s', 2)]