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:
Use the copy_from cursor method
f = open(r'C:\Users\n\Desktop\data.csv', 'r') cur.copy_from(f, temp_unicommerce_status, sep=',') f.close()
The file must be passed as an object.
Since you are coping from a csv file it is necessary to specify the separator as the default is a tab character