COPY : Loading from a Local Client
To bulk
load data from a client, and without requiring database superuser privileges,
use the COPY FROM LOCAL option.
We have
already seen this option in earlier examples.
We can
load from either STDIN, or a specific path, but not from a specific node
(or ON ANY NODE), since you are loading from the client.
Imp Disadvantage: All local files are
loaded and parsed serially with each COPY statement, so you cannot perform
parallel loads with the LOCAL option.
We can
use * while loading Copy local to load multiple files. However note that they
dont get distributed across nodes.
sukul1=> COPY USER_30_DAY_TABLES.EMPLOYEE_1
sukul1-> (
sukul1(> NAME,
sukul1(> AGE,
sukul1(> JOINING_DATE FILLER VARCHAR(10),
sukul1(> JOINING_YEAR AS
TO_NUMBER(TO_CHAR(TO_DATE(JOINING_DATE,'YYYY-MM-DD'),'YYYY')),
sukul1(> SALARY
sukul1(> )
sukul1-> FROM LOCAL
'/home/sukul1/employeedet*.dat'
sukul1-> DELIMITER '|'
sukul1-> ABORT ON ERROR
sukul1-> DIRECT;
Rows
Loaded
-------------
4
(1 row)
This
loads both the files employeedet1.dat and employeedet2.dat
No comments:
Post a Comment