Perform Sqoop import of order_items - --warehouse-dir


Let us see how we can specify the HDFS location using –warehouse-dir while performing import.

  • If we specify –warehouse-dir, it will create a sub directory with the name of the table.
  • Data will be copied to that sub-directory.
  • If the sub-directory already exists, it will fail saying directory already exists.

Here is the example to import retail_db.orders to /user/training/sqoop_import/retail_db using warehouse-dir.

sqoop import \
  --connect "jdbc:mysql://" \
  --username retail_user \
  --password itversity \
  --table order_items \
  --warehouse-dir /user/training/sqoop_import/retail_db