Sandeep
Sandeep

Reputation: 31

Sqoop pipe delimiter

I am new to sqoop.

I am running the below sqoop command to import data from an oracle table

sqoop import --connect jdbc:oracle:thin:<username>/<password>@<IP>:1521:MSDP2 --query "select * from table_name where \$CONDITIONS AND  created=TRUNC(TO_DATE('20171101','YYYYMMDD'))"   --target-dir /stage/ESM/esm_tmp  --hive-table ESM_tab --hive-import -m 1

This is creating an hive table with COMMA delimiter. Since one column contains address of the customer as its value, the field contains comma in it. This is causing the data in the table to be erratic.

while googling i found that we can use the "--fields-terminated-by " option in the sqoop command to specify the delimiter we want. but i dont know where to place it in sqoop command . can somebody help me my placing the command in the right place in the above sqoop command. I prefer a | ( pipe ) delimiter.

Upvotes: 1

Views: 2777

Answers (2)

Bigboss
Bigboss

Reputation: 21

You can use anywhere after sqoop import. The best case you can use after the query

--fields-terminated-by '|'

It will work. Please try

Upvotes: -1

Dev
Dev

Reputation: 13773

You can add --fields-terminated-by '|' anywhere in the command after sqoop import.

Upvotes: 3

Related Questions