Command based and URL based web external tables example

Post date: May 02, 2013 2:20:47 PM

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 );