Thread: newbee, about a bulk loading from a cdv file

newbee, about a bulk loading from a cdv file

From
Alonso Isidoro Roman
Date:
hi, i am just trying to do a bulk data loading using this way and i am finding problems. I have just created an user in my system, tom/mypass, then i have just created the user and the database, then the tables:

MacBook-Pro-Retina-de-Alonso:~ aironman$ psql template1
psql (9.3.5)
Type "help" for help.

template1=# CREATE USER tom WITH PASSWORD 'mypass';
CREATE ROLE
template1=# CREATE DATABASE "TrialDB";
CREATE DATABASE
template1=# GRANT ALL PRIVILEGES ON DATABASE "TrialDB" to tom;
GRANT

TrialDB=> CREATE TABLE core2door_element
TrialDB-> (
TrialDB(>   id serial NOT NULL,
TrialDB(>   key character varying(255) NOT NULL,
TrialDB(>   type character varying(255) NOT NULL,
TrialDB(>   label character varying(255) NOT NULL,
TrialDB(>   longitude double precision NOT NULL,
TrialDB(>   latitude double precision NOT NULL,
TrialDB(>   parent_id integer,
TrialDB(>   CONSTRAINT core2door_element_pkey PRIMARY KEY (id),
TrialDB(>   CONSTRAINT core2door_element_parent_id_fkey FOREIGN KEY (parent_id)
TrialDB(>       REFERENCES core2door_element (id) MATCH SIMPLE
TrialDB(>       ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED
TrialDB(> )
TrialDB-> WITH (
TrialDB(>   OIDS=FALSE
TrialDB(> );
CREATE TABLE
TrialDB=> ALTER TABLE core2door_element OWNER TO tom;
ALTER TABLE

Now, if i try to launch COPY command:

TrialDB=> COPY core2door(id,key,type,label,longitude,latitude,parent_id) FROM '/Users/aironman/Documents/tektroniks/fake_data_entity.csv' WITH DELIMITER ',' CSV HEADER;
ERROR:  must be superuser to COPY to or from a file
HINT:  Anyone can COPY to stdout or from stdin. psql's \copy command also works for anyone.

COPY is not working, trying with \copy:

TrialDB=> \copy core2door(id,key,type,label,longitude,latitude,parent_id) FROM '/Users/aironman/Documents/tektroniks/fake_data_entity.csv' WITH DELIMITER ',' CSV HEADER;
/Users/aironman/Documents/tektroniks/fake_data_entity.csv: Permission denied

permission denied too!

As you can see, the cdv file have every permission:

MacBook-Pro-Retina-de-Alonso:tektroniks aironman$ ls -l fake_data_entity.csv 
-rwxrwxrwx+ 1 aironman staff 351 sep 15 09:53 fake_data_entity.csv

what do i am doing wrong?

Regards!

PS

my apologies if this is a not a correct question, but i am desperate.

Alonso Isidoro Roman.

Mis citas preferidas (de hoy) :
"Si depurar es el proceso de quitar los errores de software, entonces programar debe ser el proceso de introducirlos..."
 -  Edsger Dijkstra

My favorite quotes (today):
"If debugging is the process of removing software bugs, then programming must be the process of putting ..."
  - Edsger Dijkstra

"If you pay peanuts you get monkeys"

Re: newbee, about a bulk loading from a cdv file

From
Albe Laurenz
Date:
Alonso Isidoro Roman wrote:
> hi, i am just trying to do a bulk data loading using this way and i am finding problems. I have just
> created an user in my system, tom/mypass, then i have just created the user and the database, then the
> tables:

[...]

> TrialDB=> \copy core2door(id,key,type,label,longitude,latitude,parent_id) FROM
> '/Users/aironman/Documents/tektroniks/fake_data_entity.csv' WITH DELIMITER ',' CSV HEADER;
> /Users/aironman/Documents/tektroniks/fake_data_entity.csv: Permission denied
> 
> permission denied too!
> 
> As you can see, the cdv file have every permission:
> 
> MacBook-Pro-Retina-de-Alonso:tektroniks aironman$ ls -l fake_data_entity.csv
> -rwxrwxrwx+ 1 aironman staff 351 sep 15 09:53 fake_data_entity.csv
> 
> what do i am doing wrong?

This seems to be an operating system problem rather than a PostgreSQL problem,
and I don't know Mac OS, but I'd suspect that even though you have the permissions
on the file itself, you might lack permissions to traverse the directories where
it is.

What do you get when you try to read the file with a different program (e.g. "cat")?
Can cou "cd" into the directory where the file is?

Yours,
Laurenz Albe

Re: newbee, about a bulk loading from a cdv file

From
Gerald Cheves
Date:

You may have to set permissions for the "tektroniks" directory

$ cd  /Users/aironman/Documents
$ mkdir tektroniks
$ chown tom tektroniks
$ chmod 755 tektroniks
$ ls -la

On 9/15/2014 6:04 AM, Alonso Isidoro Roman wrote:
> hi, i am just trying to do a bulk data loading using this way and i am
> finding problems. I have just created an user in my system,
> tom/mypass, then i have just created the user and the database, then
> the tables:
>
> MacBook-Pro-Retina-de-Alonso:~ aironman$ psql template1
> psql (9.3.5)
> Type "help" for help.
>
> template1=# CREATE USER tom WITH PASSWORD 'mypass';
> CREATE ROLE
> template1=# CREATE DATABASE "TrialDB";
> CREATE DATABASE
> template1=# GRANT ALL PRIVILEGES ON DATABASE "TrialDB" to tom;
> GRANT
>
> TrialDB=> CREATE TABLE core2door_element
> TrialDB-> (
> TrialDB(>   id serial NOT NULL,
> TrialDB(>   key character varying(255) NOT NULL,
> TrialDB(>   type character varying(255) NOT NULL,
> TrialDB(>   label character varying(255) NOT NULL,
> TrialDB(>   longitude double precision NOT NULL,
> TrialDB(>   latitude double precision NOT NULL,
> TrialDB(>   parent_id integer,
> TrialDB(>   CONSTRAINT core2door_element_pkey PRIMARY KEY (id),
> TrialDB(>   CONSTRAINT core2door_element_parent_id_fkey FOREIGN KEY
> (parent_id)
> TrialDB(>       REFERENCES core2door_element (id) MATCH SIMPLE
> TrialDB(>       ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE
> INITIALLY DEFERRED
> TrialDB(> )
> TrialDB-> WITH (
> TrialDB(>   OIDS=FALSE
> TrialDB(> );
> CREATE TABLE
> TrialDB=> ALTER TABLE core2door_element OWNER TO tom;
> ALTER TABLE
>
> Now, if i try to launch COPY command:
>
> TrialDB=> COPY
> core2door(id,key,type,label,longitude,latitude,parent_id) FROM
> '/Users/aironman/Documents/tektroniks/fake_data_entity.csv' WITH
> DELIMITER ',' CSV HEADER;
> ERROR:  must be superuser to COPY to or from a file
> HINT:  Anyone can COPY to stdout or from stdin. psql's \copy command
> also works for anyone.
>
> COPY is not working, trying with \copy:
>
> TrialDB=> \copy
> core2door(id,key,type,label,longitude,latitude,parent_id) FROM
> '/Users/aironman/Documents/tektroniks/fake_data_entity.csv' WITH
> DELIMITER ',' CSV HEADER;
> /Users/aironman/Documents/tektroniks/fake_data_entity.csv: Permission
> denied
>
> permission denied too!
>
> As you can see, the cdv file have every permission:
>
> MacBook-Pro-Retina-de-Alonso:tektroniks aironman$ ls -l
> fake_data_entity.csv
> -rwxrwxrwx+ 1 aironman staff 351 sep 15 09:53 fake_data_entity.csv
>
> what do i am doing wrong?
>
> Regards!
>
> PS
>
> my apologies if this is a not a correct question, but i am desperate.
>
> Alonso Isidoro Roman.
>
> Mis citas preferidas (de hoy) :
> "Si depurar es el proceso de quitar los errores de software, entonces
> programar debe ser el proceso de introducirlos..."
>  -  Edsger Dijkstra
>
> My favorite quotes (today):
> "If debugging is the process of removing software bugs, then
> programming must be the process of putting ..."
>   - Edsger Dijkstra
>
> "If you pay peanuts you get monkeys"
>


--
siamo arrivati sani e salvi



Re: newbee, about a bulk loading from a cdv file

From
Jude DaShiell
Date:
Who owns fakedata.csv?  If not you, that could be your problem.  As root,
try chown tom fakedata.csv then try again.



--


On Mon, 15 Sep 2014, Alonso Isidoro Roman wrote:

> hi, i am just trying to do a bulk data loading using this way and i am
> finding problems. I have just created an user in my system, tom/mypass, then
> i have just created the user and the database, then the tables:
>
> MacBook-Pro-Retina-de-Alonso:~ aironman$ psql template1
> psql (9.3.5)
> Type "help" for help.
>
> template1=# CREATE USER tom WITH PASSWORD 'mypass';
> CREATE ROLE
> template1=# CREATE DATABASE "TrialDB";
> CREATE DATABASE
> template1=# GRANT ALL PRIVILEGES ON DATABASE "TrialDB" to tom;
> GRANT
>
> TrialDB=> CREATE TABLE core2door_element
> TrialDB-> (
> TrialDB(>   id serial NOT NULL,
> TrialDB(>   key character varying(255) NOT NULL,
> TrialDB(>   type character varying(255) NOT NULL,
> TrialDB(>   label character varying(255) NOT NULL,
> TrialDB(>   longitude double precision NOT NULL,
> TrialDB(>   latitude double precision NOT NULL,
> TrialDB(>   parent_id integer,
> TrialDB(>   CONSTRAINT core2door_element_pkey PRIMARY KEY (id),
> TrialDB(>   CONSTRAINT core2door_element_parent_id_fkey FOREIGN KEY
> (parent_id)
> TrialDB(>       REFERENCES core2door_element (id) MATCH SIMPLE
> TrialDB(>       ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY
> DEFERRED
> TrialDB(> )
> TrialDB-> WITH (
> TrialDB(>   OIDS=FALSE
> TrialDB(> );
> CREATE TABLE
> TrialDB=> ALTER TABLE core2door_element OWNER TO tom;
> ALTER TABLE
>
> Now, if i try to launch COPY command:
>
> TrialDB=> COPY core2door(id,key,type,label,longitude,latitude,parent_id)
> FROM '/Users/aironman/Documents/tektroniks/fake_data_entity.csv' WITH
> DELIMITER ',' CSV HEADER;
> ERROR:  must be superuser to COPY to or from a file
> HINT:  Anyone can COPY to stdout or from stdin. psql's \copy command also
> works for anyone.
>
> COPY is not working, trying with \copy:
>
> TrialDB=> \copy core2door(id,key,type,label,longitude,latitude,parent_id)
> FROM '/Users/aironman/Documents/tektroniks/fake_data_entity.csv' WITH
> DELIMITER ',' CSV HEADER;
> /Users/aironman/Documents/tektroniks/fake_data_entity.csv: Permission denied
>
> permission denied too!
>
> As you can see, the cdv file have every permission:
>
> MacBook-Pro-Retina-de-Alonso:tektroniks aironman$ ls -l
> fake_data_entity.csv 
> -rwxrwxrwx+ 1 aironman staff 351 sep 15 09:53 fake_data_entity.csv
>
> what do i am doing wrong?
>
> Regards!
>
> PS
>
> my apologies if this is a not a correct question, but i am desperate.
>
> Alonso Isidoro Roman.
>
> Mis citas preferidas (de hoy) :
> "Si depurar es el proceso de quitar los errores de software, entonces
> programar debe ser el proceso de introducirlos..."
>  -  Edsger Dijkstra
>
> My favorite quotes (today):
> "If debugging is the process of removing software bugs, then programming
> must be the process of putting ..."
>   - Edsger Dijkstra
>
> "If you pay peanuts you get monkeys"
>
>
>