- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Running a sqoop job with a --target-dir destination and a --hive-import clause does not create table in the target destination folder
- Labels:
-
Apache Hive
-
Apache Sqoop
Created ‎06-26-2018 02:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am running a sqoop job which has a --query statement. This mandates a --target-dir clause, however when I provide a path say /user/xyz/sqoop_import/database/table1. However this path is not honored and instead the data is stored as a hive table in the warehouse folder hdfs://namenode:8020/apps/hive/warehouse/play.
Here is the Sqoop Job run:
sqoop import \
--connect "jdbc:sqlserver://xx.aa.dd.aa;databaseName=XYZ" \
--connection-manager org.apache.sqoop.manager.SQLServerManager \
--username XXXX \
--password XXXX \
--num-mappers 20 \
--query "select ID,name,x,y,z from TABLE1 where DT between '2018/01/01' and '2018/01/31' AND \$CONDITIONS" \
--split-by id \
--relaxed-isolation \
--target-dir /user/XXXX/sqoop_import/XYZ/2018/TABLE1 \
--fetch-size=100000 \ --hive-import \ --hive-table TABLE1 \
--hive-partition-key Reportdate \
--hive-partition-value Reportdate \
--as-parquetfile \
--compress \
--compression-codec org.apache.hadoop.io.compress.SnappyCodec;
Created ‎06-27-2018 03:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While running hive import target-dir argument value controls where the data needs to store temporarily before loading into Hive table, but target-dir doesn't create hive table in that location.
If you want to import to specific directory then use target-dir without hive-import argument and create hive table on top of HDFS directory.
(or)
Create Hive external table pointing to your target-dir then in sqoop import remove --create-hive-table argument and --target-dir.
For more info refer to this HCC thread regarding the same issue.
