RedShift - CSV load with line Break

2019-07-18 16:03发布

问题:

Im trying to load a CSV file while loading I got the error

Delimited value missing end quote

CSV file Error line

REDSHIFT ERROR:

line_number     | 13
colname         | Comment
col_length      | 250
raw_line        |"123"|"123"|"xyz"|"2009-06-25 21:00:14.660000000"|"0"|""|""|""|""|""|"HI,

raw_field_value | HI, 
err_code        | 1214
err_reason      | Delimited value missing end quote

回答1:

You'll need to escape the newline characters in the source data and then specify the ESCAPE option in your COPY statement. Please have a look at "Preparing Files for COPY with the ESCAPE Option" for more details.



回答2:

You could use CSV option in COPY command. Don't use REMOVEQUOTES or ESCAPE with it. CSV handles everything so in my opinion it's the best solution.

http://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-format.html#copy-csv