You are on page 1of 7

Practice 26:09:2016

Scoop
Import
mrinomy@ubuntu(terminal)

Than error will generate : Access denied

root@ubuntu (terminal)
In mysql we have to write the query:

% = For all user we can give access

= for all non-database user

IMPORT COMMAND:-

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24;

In browser we can check that mysql emp data is store in HDFS

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24for --fields-terminatedby \t;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24Col1 --fieldsterminated-by | --columns ename,esal;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24Cond --fieldsterminated-by | --where esal>200000;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24Cond --fields-

terminated-by

| --where esal>25000;

How to compress data while importing :


root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table
emp
--compression-codec GzipCodec m 1 --target-dir
/Gzipfile24;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
--compression-codec SnappyCodec m 1 --targetdir /Snappyfile24;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
emp --as-sequencefile m 1 --target-dir /sequencefile;

You might also like