Reply
Explorer
Posts: 6
Registered: ‎09-20-2017

Sqoop- Escape delimiters within data

I'm trying to sqoop import from Teradata using the below command 

 

sqoop import --connect jdbc:teradata://xxx --username xxx-P 
--query "SELECT TOP 1000 col,col2 from tble where 1=1 AND \$CONDITIONS"
--escaped-by ',' --fields-terminated-by ','
--target-dir /hadoop/dev/test -m1

 

Currently the data has , in the fields and is not escaped using --escaped-by parameter too.

 

Is there any other way?

 

 

 

 

Posts: 394
Topics: 11
Kudos: 60
Solutions: 35
Registered: ‎09-02-2016

Re: Sqoop- Escape delimiters within data

@tkrish03

 

You can control it in your query itself instead of escape delimiter, it may help you

 

select  REGEXP_REPLACE(col1,',','') AS col1, col2 from tablename1

Explorer
Posts: 6
Registered: ‎09-20-2017

Re: Sqoop- Escape delimiters within data

Thanks,but the now the problem looks like it has \n characters within data and unable to escape them.
Because hive-import-drop-delims parameter is also not supported in Teradata.
Any suggestions ?

 

Announcements