postgresql-copy

How does COPY work and why is it so much faster than INSERT?

How does COPY work and why is it so much faster than INSERT? Question: Today I spent my day improving the performance of my Python script which pushes data into my Postgres database. I was previously inserting records as such: query = “INSERT INTO my_table (a,b,c … ) VALUES (%s, %s, %s …)”; for d …

Total answers: 3

copy data from csv to postgresql using python

copy data from csv to postgresql using python Question: I am on windows 7 64 bit. I have a csv file ‘data.csv’. I want to import data to a postgresql table ‘temp_unicommerce_status’ via a python script. My Script is: import psycopg2 conn = psycopg2.connect(“host=’localhost’ port=’5432′ dbname=’Ekodev’ user=’bn_openerp’ password=’fa05844d'”) cur = conn.cursor() cur.execute(“””truncate table “meta”.temp_unicommerce_status;”””) cur.execute(“””Copy …

Total answers: 8