import sys

import util.db

connection = util.db.connect()

cur = connection.cursor()

cur.execute("SET synchronous_commit = 'off'")

cur.execute('TRUNCATE TABLE postgres_log')

cur.copy_expert('COPY postgres_log FROM stdin WITH CSV', sys.stdin)

cur.close()

connection.commit()
connection.close()