Creating External Tables - Examples

A newer version of this documentation is available. Click here to view the most up-to-date release of the Greenplum 4.x documentation.

Creating External Tables - Examples

The following examples show how to define external data with different protocols. Each CREATE EXTERNAL TABLE command can contain only one protocol.

Note: When using IPv6, always enclose the numeric IP addresses in square brackets.

Start gpfdist before you create external tables with the gpfdist protocol. The following code starts the gpfdist file server program in the background on port 8081 serving files from directory /var/data/staging. The logs are saved in /home/gpadmin/log.

gpfdist -p 8081 -d /var/data/staging -l /home/gpadmin/log &

The CREATE EXTERNAL TABLE SQL command defines external tables, the location and format of the data to load, and the protocol to use to load the data, but does not load data into the table. For example, the following command creates an external table, ext_expenses, from pipe ('|') delimited text data located on etlhost-1:8081 and etlhost-2:8081. See the Greenplum Database Reference Guide for information about CREATE EXTERNAL TABLE.