通过标准输入输出实现Greenplum文件导入导出方法:
导出:
psql -h 192.168.0.1 -U test_user test_db -c "copy(select * from test_schema.test_table where Day_Id = '20140105' limit 2000) to STDOUT;" >/mytemp/test.txt 导入:
cat /mytemp/test.txt |psql -h 192.168.0.1 -U test_user test_db -c 'copy test_schema.test_table from stdin;'
使用标准输入输出实现Greenplum文件导入导出方法

本文介绍了如何通过标准输入输出在Greenplum中实现文件的导入和导出,包括导出操作使用copy命令将指定表的数据输出到标准输出,然后重定向到本地文件;导入操作则是先读取本地文件内容,再通过标准输入应用到copy命令,完成数据的导入过程。
1693

被折叠的 条评论
为什么被折叠?



