sqlCmd = """PREPARE myInsert (int, timestamp, real, text) AS
   INSERT INTO myBigTable (idNumber, date_obs, result, user)
     SELECT $1, $2, $3, $4 WHERE NOT EXISTS
     (SELECT 1 FROM myBigTable WHERE (idNumber, date_obs, user)=($1, $2, $4));"""
curPG.execute(sqlCmd)
cptInsert = 0
curPG.execute('EXECUTE myInsert(%s,%s,%s,%s);', myNewRecord)
allreadyExists = curPG.rowcount < 1
if not allreadyExists:
    cptInsert += 1
if cptInsert % 10000 == 0:
    conPG.commit()
Python-PostgreSQL psycopg2 interface --> executemany