greenplum使用gpfdist外部表加载数据
greneplum安装后自带gpfdist启动程序,在安装目录/bin下,指定端口,共享文件路径启动即可
gpfdist -d /var/load_files -p 8081 &
准备数据文件,本例为t_user.text,上传至/var/load_file下
1^测试啦啦啦^2222^
2^^2^2018-07-24 09:50:10.000
3^111111111111111^3^2018-07-23 16:57:25.000
4^2222222222222222^4^2018-07-23 16:57:27.000
5^e^5^2018-07-15 17:09:36.000
6^f^6^2018-07-15 17:09:36.000
是gp库中创建外部表,location指定gpfdist文件
CREATE EXTERNAL TABLE t_user_ext
(
id ,
username ,
age ,
update_time
)
LOCATION (
'gpfdist://ip:8081/t_user.text'
)
FORMAT 'text' (delimiter '^' null '' escape '\\')
t_user.text为数据文件, delimiter为数据字段列分割符,null ”为null值转换,escape用于转义
外部表创建成功后即可像正常表一样查询数据了