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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠