Sqoop Import - Need double quotes for string fields, and no double quotes needed for non-string fields


#1

I am trying to import data from mysql to hdfs. While importing, I need all the string fields to have double quotes and non-string fields with no double quotes.

sqoop import \
  --connect jdbc:mysql://ms.itversity.com:3306/retail_db \
  --username retail_user \
  --password itversity \
  --target-dir /user/nikhilvemula/sqoop_import/retail_db/orders_test \
  --num-mappers 1 \
  --query "SELECT * FROM orders WHERE \$CONDITIONS and order_date LIKE '2014-01-%'" \
  --optionally-enclosed-by '"' \
  --enclosed-by '"' \
  --null-string '\\N' \
  --null-non-string '\\N' \
  --delete-target-dir

Expected:
25876,2014-01-01 00:00:00.0,3414,“PENDING_PAYMENT”

Actual result I got:
“25876”,“2014-01-01 00:00:00.0”,“3414”,“PENDING_PAYMENT”