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用於轉義
外部表創建成功後即可像正常表一樣查詢數據了