I want to replace database table values with dataframe values. Need your advice !
I have a database with table Data as follows:
Ref Text Queue EmailID
1 ABC PQ [email protected]
and a dataframe : df['EmailID','Queue'] as follows:
Queue EmailID
GQ [email protected]
I want to replace EmailID, Queue from Data table with dataframe values in python.
I have a code as follows:
cur.execute ("""UPDATE tblops.uploadmanagement SET Queue=%s WHERE EmailID=%s""", (df['Journey1'], df['EmailID']))
I am getting following errors:
The SQL contains 0 parameter markers, but 2 parameters were supplied', 'HY000'
Expected :
Ref Text Queue EmailID
1 ABC GQ [email protected]
I have gone through following links:
Writing Python Dataframe to MSSQL Table
http://www.mysqltutorial.org/python-mysql-insert/
Need your advice !
'%s'not%sfor the parameter markers. I'm not sure it will work, though, supplying whole Series objects.