I have the following queries in python mysql.connector:
query="SELECT `AUTO_INCREMENT`FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'cl55-mm-px-db' AND TABLE_NAME = 'dj_Venues';"
cursor.execute(query)
autoV=str(cursor.fetchone())
autoV=autoV.replace('(','').replace(')','').replace(',','')
query="REPLACE INTO dj_Venues SET venueName = %s,venueAddress = %s,venueBands = %s,venueResident = %s,city=%s,country=%s;'"
variable=(venue,address,venueID,venueID1,city,country1)
cursor.execute(query,variable )
query="SELECT `AUTO_INCREMENT`FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'cl55-mm-px-db' AND TABLE_NAME = 'dj_Events';"
cursor.execute(query)
autoE=str(cursor.fetchone())
autoE=autoE.replace('(','').replace(')','').replace(',','')
query="REPLACE INTO dj_Events SET eventName = %s,bandsintownID = %s,residentID=%s,date = %s,startTime=%s,sourceBands=%s,sourceResident=%s;'"
variable=(eventName,eventID,eventID1,date,start,source,source)
cursor.execute(query,variable )
query="REPLACE INTO dj_Master SET artistID = %s,eventID = %s,venueID = %s;'"
variable=(artistID,autoE,autoV)
cursor.execute(query,variable )
And when I run this script I get the following error:
"Use multi=True when executing multiple statements")
mysql.connector.errors.InterfaceError: Use multi=True when executing multiple statements
I added multi=True in every cursor.execute() but the queries don't execute so my tables remain empty!
multi=Truetoexecute, rather than have you usecursor.executemany()