当前位置:操作系统 > Unix/Linux >>

web os commander外部表

web os commander外部表
 
web外部表是只读的的,不像常规的外部表那样可以有写入的,而os commander web外部表的一个变形体,具体看几个例子。
gtlions=# create external web table e_web2 (like emp) execute 'cat ~/gpfdist/emp_exp.txt' format 'text';
CREATE EXTERNAL TABLE
gtlions=# select * from e_web2;      
 empno | ename  |    job    | mgr  |  hiredate  |   sal    |   comm   | deptno 
-------+--------+-----------+------+------------+----------+----------+--------
  7499 | ALLEN  | SALESMAN  | 7698 | 1981-02-20 |  1600.00 |   300.00 |     30
  7521 | WARD   | SALESMAN  | 7698 | 1981-02-22 |  1250.00 |   500.00 |     30
  7698 | BLAKE  | MANAGER   | 7839 | 1981-05-01 |  2850.00 |          |     30
  7782 | CLARK  | MANAGER   | 7839 | 1981-06-09 |  2450.00 |          |     10
  7788 | SCOTT  | ANALYST   | 7566 | 1982-12-09 |  3000.00 |          |     20
  7844 | TURNER | SALESMAN  | 7698 | 1981-09-08 |  1500.00 |     0.00 |     30
  。。。
  。。。
gtlions=# create external web table e_web3(txt text) execute 'echo ''this is a rows for e_web3'' ' format 'text';
CREATE EXTERNAL TABLE
gtlions=# select * from e_web3;
            txt            
---------------------------
 this is a rows for e_web3
 this is a rows for e_web3
(2 rows)
gtlions=# create external web table e_web7(txt text) execute 'date' on segment 0 format 'text';             
CREATE EXTERNAL TABLE
gtlions=# select * from e_web7;      
             txt              
------------------------------
 Sat May  4 10:29:41 CST 2013
(1 row)
原来os commander web external可以执行任何os的命令,而且还可以控制是否只在master上执行和在哪个节点上执行,比如最后一个例子e_web7。
-EOF-
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,