質問

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