是否可以使用选项定界符创建外部表?

问题描述 投票:0回答:1

我想在greenplum中创建外部表:

CREATE EXTERNAL TABLE hctest.ex_abs
(
a text,
b text,
c text,
d text,
e text,
f text
)
LOCATION ('gpfdist://192.168.56.111:10000/abs31032020.csv')
FORMAT 'CSV' (DELIMITER ',' HEADER);

但是文件abs31032020.csv中的值是这样的:

Employee ID,Time Type,Start Date,End Date,Number Of Days,Comment
90007507,Leave,05/08/2020,05/08/2020,1,"dear mas Andria, kindly approve 1 day leave at 8th May. Thank you."
90006988,Leave,04/20/2020,04/21/2020,2,"Dear Mas Tommy,
Herewith I would like to ask your approval for my leave which will be taken on 20 - 21 April 2020 (2 days of leave). I take this leave because of I need to attend the family wedding out of town along with visiting my extended family before Ramadhan in my hometown. 

Your approval will be highly appreciated.

Thank you,
Andrian Indrawan"

在“字段注释”中,有一个使用“输入”的值。它在greenplum表中显示为新行。

所以我该如何从这样的格式文件创建外部表?谢谢

greenplum
1个回答
0
投票

仅在GP 6.4上进行了测试,并且通过两个更改就可以正常工作:

  • 使用'file://'代替gpfdist
  • [在提供的数据样本的最后一行添加了一个双引号。
CREATE EXTERNAL TABLE ext.ex_abs
(
    a text,
    b text,
    c text,
    d text,
    e text,
    f text
)
LOCATION ('file://mdw/tmp/t.csv')
FORMAT 'CSV' (DELIMITER ',' HEADER);
© www.soinside.com 2019 - 2024. All rights reserved.