Uncategorized

186.Sqoop Import – Importing Query Results

Command to import query results sqoop import –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity –query “SELECT order_date, count(1) order_count FROM orders WHERE \$CONDITIONS GROUP BY order_date” –target-dir /user/training/sqoop_import/retail_db/order_count_by_date –sptit-by order—date –delete-target-dir

185.Sqoop Import – Using Split By

Command to import table and divide the data into multiple splits based on specified column. sqoop import –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity –table order_items –warehouse-dir /user/training/sqoop_import/retail_db –delete-target-dir –split-by order_item_order_id

184.Sqoop Import – Filter unnecessary data

Command to explore first 10 records of orders table: sqoop eval –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity -e “SELECT * FROM orders LIMIT 10” Command to explore orders table with where condition; sqoop eval –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity -e “SELECT * FROM orders WHERE order_status IN (‘COMPLETE’, ‘CLOSED’) AND order_date LIKE ‘2013-08%’ ” …

184.Sqoop Import – Filter unnecessary data Read More »

182.Sqoop Import – Specifying Columns

To get schema details on customers table: sqoop eval –connect jdbc:mysql://ms.itversity.com:3306/ retail_db –username retail_user –password itversity -e “DESCRIBE customers” Command to import table with specified columns: sqoop import –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity –table customers –columns customer_id,customer_fname,customer_lname,customer_street,customer_city,customer_state,customer_zipcode –warehouse-dir /user/training/sqoop_import/retail_db –delete-target-dir To validate imported table: hadoop fs -ls /user/training/sqoop_import/retail_db hadoop fs -ls /user/training/sqoop_import/retail_db/customers hadoop fs …

182.Sqoop Import – Specifying Columns Read More »