Redshift COPY command delimiter not found

匿名 (未验证) 提交于 2019-12-03 02:50:02

问题:

I'm trying to load some text files to Redshift. They are tab delimited, except for after the final row value. That's causing a delimiter not found error. I only see a way to set the field delimiter in the COPY statement, not a way to set a row delimiter. Any ideas that don't involve processing all my files to add a tab to the end of each row?

Thanks

回答1:

I don't think the problem is with missing <tab> at the end of lines. Are you sure that ALL lines have correct number of fields?

Run the query:

select le.starttime, d.query, d.line_number, d.colname, d.value, le.raw_line, le.err_reason     from stl_loaderror_detail d, stl_load_errors le where d.query = le.query order by le.starttime desc limit 100 

to get the full error report. It will show the filename with errors, incorrect line number, and error details.

This will help to find where the problem lies.



回答2:

You can get the delimiter not found error if your row has less columns than expected. Some CSV generators may just output a single quote at the end if last columns are null.

To solve this you can use FILLRECORD on Redshift copy options.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!