- To display information and usage instructions related to export command
sqoop help export
- Command to launch hive connecting to the specified database
hive --database training_sqoop_retail
;
- Command to get list of tables
SHOW tables;
- Command to create table
CREATE TABLE daily_revenue01 AS SELECT * FROM daily_revenue;
- Command to get meta-data on table
DESCRIBE FORMATTED daily_revenue01;
- Command to copy files from HDFS to local system
hadoop fs -get /apps/hive/warehouse/training_sqoop_retail.db/daily_revenue01 .
- Command to truncate table
sqoop eval --connect jdbc:mysql://ms.itversity.com:3306/retail_export --username retail_user --password itversity -e "TRUNCATE TABLE training_daily_revenue"
- Command to export data using a delimiter
sqoop export --connect jdbc:mysql://ms.itversity.com:3306/retail_export --username retail_user --password itversity --export-dir /apps/hive/warehouse/training_sqoop_retail.db/daily_revenue01 --table training_daily_revenue --input-fields-terminated-by '\001'
- To validate table
sqoop eval --connect jdbc:mysql://ms.itversity.com:3306/retail_export --username retail_user --password itversity -e "SELECT count(1) FROM training_daily_revenue"
sqoop eval --connect jdbc:mysql://ms.itversity.com:3306/retail_export --username retail_user --password itversity -e "SELECT * FROM training_daily_revenue"
Durga Gadiraju
219.Sqoop Export – Specifying Delimiters
- March 17, 2023
- , 6:00 am
- , Uncategorized