Redshift COPY CSV NULL如果字段以'\ 0'开头,则'\ 0'不起作用

时间:2017-11-29 07:52:44

标签: csv amazon-redshift

创建表

CREATE TABLE IF NOT EXISTS "test_null_as_tab"
(
    "id" INTEGER NOT NULL  ENCODE lzo
    ,"email" VARCHAR(128)   ENCODE lzo
    ,"domain" VARCHAR(128)   ENCODE lzo
    ,PRIMARY KEY (id)
)
DISTSTYLE EVEN;

data_file1:电子邮件字段以NUL字符开头

91291240    [NUL CHAR \0]sfassssad@asdas.me asdas.me
91291240    [NUL CHAR \0]sfassssad@asdas.me asdas.me

data_file2:电子邮件字段不以NUL字符开头

91291240    -[NUL CHAR \0]sfassssad@asdas.me    asdas.me
91291240    -[NUL CHAR \0]sfassssad@asdas.me    asdas.me

以下COPY命令因.sfassssad@asdas.me 1218 Invalid null byte - field longer than 1 byte

中的stl_load_errors而失败
copy test_null_as_tab
from 's3://abrar/data_file1'
credentials 'aws_access_key_id;aws_secret_access_key='
CSV DELIMITER '\t' QUOTE '\036' COMPUPDATE OFF STATUPDATE OFF TRUNCATECOLUMNS NULL AS '\000';

以下COPY命令成功将数据加载到表

copy test_null_as_tab
from 's3://abrar/data_file2'
credentials 'aws_access_key_id=;aws_secret_access_key='
CSV DELIMITER '\t' QUOTE '\036' COMPUPDATE OFF STATUPDATE OFF TRUNCATECOLUMNS NULL AS '\000';

我没有成功使用任何COPY命令选项加载data_file1。

如何让Redshift COPY命令加载字段开头有NUL字符的数据?

0 个答案:

没有答案