0

I have a python code that will do a bulk insert into a table. If my table already contains the same data, I will get integrity error. How to check all the rows and whatever the rows are getting I need to update those as a bulk update.

i.e., In MySql we have a query Insert into ... IF exists Update... (Similar query). So I want to use that as a bulk insert in SQLAlchemy. Can anyone help me?

SANDEEP MACHIRAJU
  • 817
  • 10
  • 17
  • See https://stackoverflow.com/a/48373874/2681632 – Ilja Everilä Apr 02 '18 at 19:39
  • What I did was: 1) First I mapped the existing table of MySql to the python object. 2) Then I created Data object (list of dictionaries as key, value pairs) 3) Then I used a bulk-insert function But my question is how to do upsert of bulk data into an existing table in MySql using sqlalchemy – SANDEEP MACHIRAJU Apr 10 '18 at 21:16

0 Answers0