title: Continue executing INSERT script even on error - PostgreSQL using Python script
body: <p>I'm trying to make a bulk insert into my PostgreSQL DB using a python script (with psycopg connection). Now, the script has some duplicates on the primary column which makes it abort and rollback the entire script. However, what I want is to skip the duplicates and continue execution. My script looks something like the below</p>
  
  <pre><code>begin transaction;
  create table t1 (c1 float, unique(c1));
  insert into t1 values (1);
  insert into t1 values (2);
  insert into t1 values (1); --the script aborts and rolls back
  commit;
  </code></pre>
  
  <p>I have looked around and found out that setting the ON_ERROR_ROLLBACK helps. But it seems like, it can be set only from the psql command line.</p>
  
  <p>Is it possible to use ON_ERROR_ROLLBACK  from inside the python script? Or is there any other alternative option?</p>
  
  <p>Thanks in advance!</p>