Command based and URL based web external tables example

posted May 2, 2013, 7:20 AM by Sachchida Ojha
CREATE EXTERNAL WEB TABLE output (output text)
EXECUTE 'PATH=/home/gpadmin/programs; export PATH; 
myprogram.sh' 
FORMAT 'TEXT';

CREATE EXTERNAL WEB TABLE log_output 
(linenum int, message text) 
EXECUTE '/var/load_scripts/get_log_data.sh' ON HOST
FORMAT 'TEXT' (DELIMITER '|');

CREATE EXTERNAL WEB TABLE ext_expenses (name text, 
date date, amount float4, category text, description text) 
LOCATION ( 
'http://intranet.company.com/expenses/sales/file.csv',
'http://intranet.company.com/expenses/exec/file.csv',
'http://intranet.company.com/expenses/finance/file.csv',
'http://intranet.company.com/expenses/ops/file.csv',
'http://intranet.company.com/expenses/marketing/file.csv',
'http://intranet.company.com/expenses/eng/file.csv' 
)
FORMAT 'CSV' ( HEADER );

Comments