문제

I have taken the daily dump file and unzipped it and then placed it back up onto s3.

When I try and do a copy statement in postgresql I am receiving the following error

Missing newline: Unexpected character  0x14 found at location 4

Query:

copy temp from 's3://bucket/top-1m.csv' credentials 'blah blah blah';

Do I have to add some kinda character to each line?

Raw Data:

1,facebook.com
2,google.com
3,youtube.com
4,yahoo.com
5,amazon.com
6,baidu.com
7,wikipedia.org
8,live.com
도움이 되었습니까?

해결책

The Redshift COPY command uses PIPE '|' as the default delimiter character. If your files are delimited by another character (comma in your case), all you need to do is add the DELIMITER keyword to your COPY command.

copy temp from 's3://bucket/top-1m.csv' credentials 'blah blah blah' delimiter as ',';

or for comma separated files:

copy temp from 's3://bucket/top-1m.csv' credentials 'blah blah blah' csv;

다른 팁

copy temp from 's3://bucket/top-1m.csv' credentials 'blah blah blah' delimiter ',';

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top