Friday, June 6, 2014

Useful SQOOP tutorials



Apache Sqoop Tutorial -1 


                                                             Apache Sqoop Tutorial -2


[*Still two more useful videos are available in Youtube, Watch them from same Author.]

In Sqoop, by default 4 mappers runs for 1000 Records at maximum, to change this settins u need mention 
> --m 1 
with sqoop command to set it to 1 mapper.

Here i am trying to write few sqoop commands in the below:

1. Importing RDBMS Table to Target Directory: 
--------------------------------
>sqoop import --connect jdbc:localhost://mysql/sqoopdb --username sqoop -P\
> --table emplyee
> --target-dir <not existing folder path>
> --where "col between 1 and 100"
> -m 1


2.Importing RDBMS Table to Warehouse Directory:
-----------------------------------
>sqoop import --connect jdbc:localhost://mysql/sqoopdb --username sqoop -P\
> --table emplyee
> --warehouse-dir <Existing warehouse folder path>
> --where "col between 1 and 100"
> -m 1


3.Incremental Import:
--------------------
>sqoop import --connect jdbc:localhost://mysql/sqoopdb --username sqoop -P\
> --table emplyee \
> --warehouse-dir <Existing warehouse folder path>
> --check-colum emp_id \
> --incremental append \
> --last-value 9 \
> -m 1


4.Options file:
--------------------
sqoop> nano Import.txt

import
--connect
jdbc:localhost://mysql/sqoopdb
--username
sqoop
-P

[Note:Using above Import.txt in sqoop commands as below, and use options file flag to use above file as common parameters]

sqoop>sqoop --options-file Import.txt \
> --table emplyee \
> --warehouse-dir <Existing warehouse folder path>
> --where "col between 1 and 100"
> -m 1

No comments:

Post a Comment