sqoop Sqoop Import Import-All-Tables


Example

SQOOP provides facility to import all tables

sqoop import-all-tables \
--connect <rdbms-jdbc-url> \
--username <username> \
--password <password> \
--hive-import \
--create-hive-table \
--hive-database <dbname> \
--warehouse-dir <warehouse-dir>

Important points to note on differences between import and import-all-tables:

Need to provide --warehouse-dir=//stage.db database name as input parameter to download all tables into a database. In sqoop import we will be providing only --target-dir not the --warehouse-dir

Example:

sqoop import-all-tables --connect="jdbc:mysql://serverip:3306/dbname" 
--username=xxx --password=yyy 
-m 1 --hive-import 
--hive-overwrite 
--create-hive-table 
--hive-database dbname 
--hive-home /user/hive/warehouse
--warehouse-dir=/user/hive/warehouse/retail_stage.db