尝试使用s3将数据加载到redshift时出现错误
Invalid digit, Value 'N', Pos 0, Type: Decimal
尝试将NULL值加载到numeric数据类型列(列可为空)时失败
虽然我使用NULL AS'\ 000'转换。
COPY campaign
FROM 's3://test/campaign.csv'
credentials '------------------'
EMPTYASNULL
NULL AS '\000'
delimiter ','
region '----';
我们如何处理这种情况?
表:
CREATE TABLE campaign (
name VARCHAR(255) SORTKEY NOT NULL,
discount_med DECIMAL(5,2),
discount_packages DECIMAL(5,2),
discount_test DECIMAL(5,2)
);
示例输入:
test1,5.25,NULL,1
答案 0 :(得分:8)
而不是NULL AS '\000'
使用NULL as 'NULL'
。这在我的桌子和数据上对我有用:
COPY campaign
FROM 's3://denis-stackoverflow/campaign.csv'
credentials '---'
NULL AS 'NULL'
EMPTYASNULL
delimiter ','
region 'ap-southeast-2';