197.Sqoop Import – Create Hive Database
Command to create a database CREATE DATABASE IF NOT EXISTS training_sqoop_retail; Command to connect to a database use training_sqoop_retail; Command to get list of tables in database SHOW tables;
Command to create a database CREATE DATABASE IF NOT EXISTS training_sqoop_retail; Command to connect to a database use training_sqoop_retail; Command to get list of tables in database SHOW tables;
Command to launch hive CLI: hive Command to connect to a database use training_retail; Command to get list of tables in database SHOW tables; Command to get columns and their datatypes in a table DESCRIBE orders; Command to get all the meta-data related to a table DESCRIBE FORMATTED orders; Command to create a demo table …
To refer to information related to import-all-tables command Sqoop help import-all-tables Command to delete directory in hdfs hadoop fs -rm -R /user/training/sqoop_import/retail_db Command to get list of tables sqoop list-tables –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity Command to import all tables at once sqoop import-all-tables –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity –warehouse-dir /user/training/sqoop_import/retail_db –autoreset-to-one-mapper –num-mappers …
Command to deal with null values in a numeric column in a table while importing data sqoop import –connect jdbc:mysql://ms.itversity.com:3306/hr_db –username hr_user –password itversity –table employees –warehouse-dir /user/training/sqoop_import/hr_db –delete-target-dir –null-non-string “-1” Command to validate files created hadoop fs -get /user/training/sqoop_import/hr_db/employees . view part-m-00000
Command to import data by specified delimiters sqoop import –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity –table orders –warehouse-dir /user/training/sqoop_import/retail_db –delete-target-dir –fields-terminated-by ‘|’ –lines-terminated-by ‘:’ Command to delete directory if it exists in local system rm -rf orders Command to get files from hdfs to local system hadoop fs -get /user/training/sqoop_import/retail_db/orders . Command to view the …
192.Sqoop Import – Specifying Delimiters – Import NYSE Data with \t as delimiter Read More »
Commands to validate files in directory hadoop fs -ls /user/training/sqoop_import/retail_db/order_items hadoop fs -tail /user/training/sqoop_import/retail_db/order_items/part-m-00003 Command to refer to arguments available on import sqoop help import