Redshift Copy fails due to '\' present in some of the data in my csv file

0

I am trying to copy csv file from S3 to Redshift table. I have few of the columns present in my csv file that contains '' in the data. Below is the sample data:

columnA|columnB|columnC|columnD|columnE

abc|12|xyz|test|hello

lmn|123|pqr|test|bye

jkl|124|deg|test|hi

I am using below command to copy in Redhisft, but it fails:

COPY redshif_schema.redshift_table_name from 's3://bucket/folder/inputfile.csv' access_key_id '<access_id>' secret_access_key '<secret_key>' fillrecord escape delimiter as '|' IGNOREHEADER as 1 ACCEPTANYDATE emptyasnull blanksasnull maxerror 0 ;

When I check raw_line in stl_load_errors table, I see below (2 back slashes):

abc|12|xyz|test|hello

Can someone please help with this?

已提问 3 年前2097 查看次数
1 回答
0

Redshift is interpreting the backslash as an escape since you have specified ESCAPE in your COPY.

You can try:

已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则