0

I am using postgresql COPY command to insert data from local csv (relative path) to postgres table by below command

COPY edmonton.general_building_permit_table(permit_date, permit_number, year, month_number, report_permit_date, job_category, address, legal_description, neighbourhood, neighbourhood_number, job_description, building_type, work_type, floor_area, construction_value, zoning, units_added, latitude, longitude, location, count) FROM 'data/General_Building_Permits_01_2017.csv' DELIMITER ',' CSV HEADER;"

Am executing queries using psycopg2 python module. I am getting below error

Error could not open file "data/General_Building_Permits_02_2017.csv" for reading: No such file or directory

But the csv exists in the path. I need to know whether COPY command accepts relative path or not? or any other issues?

Harnish Kumar
  • 315
  • 5
  • 17

1 Answers1

0

You need to start from the root. And use absolute path.

for example your directory should supposed to look something like this.

/home/name/Desktop/asd.txt

kimdasuncion12
  • 319
  • 2
  • 4
  • 17