title: Insert/delete operation for large data in python without merge
body: <p>I am quite new to python. I have a table that I want to update daily. I get a csv file with large amount of data, about 15000 entries. Each row from the csv file has to be inserted in my table. But If a specific value from the file matches the primary key of any of the rows, the I want to delete the row from the table and instead insert the corresponding row from the csv file. So for eg. if my csv file is like this:</p>
  <pre><code>001|test1|test11|test111
  002|test2|test22|test222
  003|test3|test33|test333
  </code></pre>
  <p>And in my table I have a row with <code>primary key column value=002</code>, then delete that row and insert corresponding row from the file.</p>
  <p>I don't have an idea about how many rows I could get in that csv every day, with values matching primary key. I know this can be done with a <code>MERGE</code> query but I am not really sure if it will take a longer time than any other method. And it would also require me to create a temp table and truncate it every time. Same if I use <code>WHERE EXISTS</code>, I would need a temp table.</p>
  <p>What is the most efficient way to do this task?</p>
  <p>I am using Python 2.7.5 and SQL Server 2017</p>