我想将我的csv加载到AWS Redshift, 文件内容为:
39334;sms|587b083b98420f9a11c414a9;verified;2017-04-07T05:45:14.479Z;2017-05-02T13:05:32.588Z;00f8a90d-518a-40a0-b663-c4070baf2459;1494012833;2017-05-05T15:33:53.990136-0400;None;2017-04-06T22:33:06-0700;47.451199;47.451199;no;yes;no;no;no;no;no;no;yes;yes;yes;yes;1;2.0.3.1;Optional('AT&T');iPhone;10.2.1;[Decimal('11'), Decimal('12')];Phone mount;Washington;CA337B1C-EEC9-4B0E-8A3C-F5DA959D47AB;Sun Jan 15 2017 05:27:33 GMT+0000 (UTC)**
我通过 Python :
将上述内容写入csvwith open(self.path + ".csv", "a") as myfile:
file_writer = csv.writer(myfile)
file_writer.writerow([x.strip() for x in line.split(';')])
然后我上传到Amazon S3。之后我试图将我的CSV文件从S3加载到Redshift,我使用了复制命令:
copy table_name 'my_s3_location'
CREDENTIALS 'my_credential'
delimiter ',' region 'my_region';
执行复制命令时,Redshift会抛出错误:
缺少换行符:在位置38找到意外的字符0x76
我无法看到第38个位置,我只有34列。
答案 0 :(得分:0)
你能试试吗
copy table_name 'my_s3_location'
from bucketlocation
CREDENTIALS xxxxxxxxx
delimiter ';'
removequotes
acceptinvchars;