将CSV加载到Redshift:"缺少换行符:在位置2处发现意外字符"

10

我要将S3中的CSV文件加载到Redshift中。数据看起来像这样:

tweet_id,tweet_text,created_at,geo_lat,geo_long,user_id,screen_name,name,profile_image_url,is_rt
477097990809612288,RT @Sourpatchcam: Matthew espinosa is the reason I breath,2014-06-12 10:39:59,.00000,.00000,969145484,PerfectJvcob,PerfectJvcob || Bio,http://pbs.twimg.com/profile_images/477092469893382146/k1YAOGRf_normal.jpeg,True
477097991049064448,@ajama3 @SultansThrone @itsfuad Dont hold your breath.,2014-06-12 10:39:59,.00000,.00000,719529744,MareejoXaamud,¯\_(ツ)_/¯,http://pbs.twimg.com/profile_images/471392213906104321/VbyMbZ7e_normal.jpeg,False

我遇到了这个错误:

Missing newline: Unexpected character 0x74 found at location 2

(字符0x74代表字母t)

我尝试移除标题行,但是我得到了意外的字符"4"。我需要在源代码中添加/n或者其他什么吗?

4个回答

7

您应该删除标题,因为标题是字符串,而实际的列可能是整数、日期、十进制等。

尝试使用以下选项进行复制,以避免特殊字符或转义等操作:

ESCAPE ACCEPTINVCHARS


2

1
检查FROM路径中CSV文件的扩展名。最好应该是file_name**.CSV**。
这帮助我解决了问题。

0

我在文件复制方面遇到了同样的问题,当我将文件从Unicode转换为UTF-8编码时,问题得到了解决。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接