My cloud9 workspace has a .csv file and a Ruby script in a folder called 'onetwo'
Here's the Ruby script:
require 'pg'
def create_db
conn = PG.connect(dbname: 'postgres')
conn.exec("CREATE DATABASE onetwo")
conn = PG.connect(dbname: 'onetwo')
conn.exec("CREATE TABLE orgs ( id INT, description VARCHAR, PRIMARY KEY (id) )")
conn.exec("COPY orgs(id, description) FROM 'workspace/onetwo/jr_data_engineer_assignment.csv' DELIMITER ',' CSV HEADER")
end
Everything works fine until the last line (the db gets created and so does the table). Here's the message I get:
ERROR: could not open file "workspace/onetwo/jr_data_engineer_assignment.csv" for reading: No such file or directory (PG::UndefinedFile)
I get the same error if I try to specify the file path as "jr_data_engineer_assignment.csv" or as "/jr_data_engineer_assignment.csv" or as "./jr_data_engineer_assignment.csv". What is the correct way to write the file path?? Thanks.