【问题标题】:AWS Data Pipeline RedShift "delimiter not found" errorAWS Data Pipeline RedShift“未找到分隔符”错误
【发布时间】:2016-03-16 03:05:15
【问题描述】:

我正在处理数据管道。在其中一个步骤中,来自 S3 的 CSV 被 RedShift DataNode 使用。我的 RedShift 表有 78 列。检查:

SELECT COUNT(*) FROM information_schema.columns WHERE table_name = 'my_table';

RedshiftCopyActivity 'stl_load_errors' 表在位置 0 的列命名空间(这是第二列,varchar(255))的第 1 行显示“未找到分隔符”(1214) 错误。使用的 CSV 行如下所示:

0,my.namespace.string,2119652,458031,S,60,2015-05-02,2015-05-02 14:51:02,2015-05-02 14:51:14.0,1,Counter,1,Counter 01,91,Chaymae,0,,,,227817,1,Dine In,5788,2015-05-02 14:51:02,2015-05-02 14:51:27,17.45,0.00,0.00,17.45,,91,Chaymae,0,0.00,12,M,A,-1,13,F,0,0,2,2.50,F,1094055,Coleslaw Md Upt,8,Sonstige,900,Sides,901,Sides,0.00,0.00,0,,,0.0000,0,0,,,0.00,0.0000,0.0000,0,,,0.00,0.0000,,1,Woche Counter,127,Coleslaw Md Upt,2,2.50

简单替换(“,”到“\n”)后,我有 78 行,所以看起来数据应该匹配......我坚持下去。也许有人知道我如何找到有关错误的更多信息或查看解决方案?

编辑

查询:

select d.query, substring(d.filename,14,20), 
d.line_number as line, 
substring(d.value,1,16) as value,
substring(le.err_reason,1,48) as err_reason
from stl_loaderror_detail d, stl_load_errors le
where d.query = le.query
and d.query = pg_last_copy_id(); 

结果为 0 行。

【问题讨论】:

    标签: csv amazon-web-services amazon-s3 amazon-redshift amazon-data-pipeline


    【解决方案1】:

    您需要添加 FORMAT AS JSON 's3://yourbucketname/aJsonPathFile.txt'。 AWS 还没有提到这一点。请注意,这仅在您的数据为 json 格式时才有效,例如

    {'attr1': 'val1', 'attr2': 'val2'} {'attr1': 'val1', 'attr2': 'val2'} {'attr1': 'val1', 'attr2': 'val2'} {'attr1': 'val1', 'attr2': 'val2'}

    【讨论】:

      【解决方案2】:

      我想通了,也许它对其他人有用:

      实际上有两个问题。

      1. 我在红移表中的第一个字段是 INT IDENTITY(1,1) 类型,在 CSV 中我有 0 值。从 CSV 中删除第一列后,即使没有指定列映射,如果...
      2. DELIMITER ',' commandOption 已添加到 S3ToRedshiftCopyActivity 以强制使用逗号。如果没有它,RedShift 会将命名空间 (my.namespace.string) 中的点识别为分隔符。

      【讨论】:

        猜你喜欢
        • 2017-08-10
        • 1970-01-01
        • 1970-01-01
        • 2014-03-18
        • 1970-01-01
        • 2011-09-20
        • 2023-03-04
        • 1970-01-01
        • 2016-08-31
        相关资源
        最近更新 更多