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%' "
  • Command to import table with records that satisfy specified WHERE condition:
    • 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 --where "order_status IN ('COMPLETE' ,'CLOSED') AND order_date LIKE '2013-08%' "

Share this post