问题
I'm getting load errors when trying to load data into Redshift. My error is:
Missing newline: Unexpected character 0x24 found at location nnn
I'm using this command which includes the ACCEPTINVCHARS option, and the column in question is defined as VARCHAR(80)
copy <dest_tbl> from <S3 source>
CREDENTIALS <my_credentials> IGNOREHEADER 1 ENCODING UTF8
IGNOREBLANKLINES NULL AS '\\N'
EMPTYASNULL BLANKSASNULL gzip ACCEPTINVCHARS timeformat 'auto'
dateformat 'auto' MAXERROR 1 compupdate on;
The errors look like this in vi
An octal dump looks like this:
I'm not understanding why this is failing given the ACCEPTINVCHARS documentation at Amazon Can anyone suggest a solution or a workaround? Put another way, what do I need to do to ensure that Redshift accepts this string in this field?
回答1:
Octal dump shows they are null values (NUL) which are treated as line terminator by redshift copy command.
Use NULL AS '\0' instead default '\N',
来源:https://stackoverflow.com/questions/43297955/why-doesnt-acceptinvchars-work-here