CREATE EXTERNAL DATASOURCE command

You can use the CREATE EXTERNAL DATASOURCE command to create external data sources.

External data sources are used to establish connection between storage accounts, and support the first use of data virtualization and data loading.

To create an external data source, you must set ENABLE_EXTERNAL_DATASOURCE to 1.
SET ENABLE_EXTERNAL_DATASOURCE = 1;

Syntax

To create a data source, run:
CREATE EXTERNAL DATASOURCE external data source name
ON AWSS3
USING (
   external data source options
);
To create an external data source, run:
CREATE EXTERNAL DATASOURCE DATASOURCE
ON AWSS3 
USING (
   ACCESSKEYID ACCESSKEYID 
   SECRETACCESSKEY SECRETACCESSKEY 
   BUCKET BUCKET 
   REGION REGION
);
Tip:
  1. After you create an external datasource definition, you can use ALTER statements to modify the external data source columns or SHOW statements to view the external data source column values.
  2. You can use the verbose option with the SHOW command. When you run the command, the column values are combined to form the cloud connection string for that external data source.
    SHOW EXTERNAL DATASOURCE NYCTAXIS3 VERBOSE;
    CONN      | REMOTESOURCE 
    ------------------------
    ACCESSKEYID=ACCESS KEY ID:BUCKETURL=URL:DEFAULTREGION=REGION:SECRETACCESSKEY=SECRET ACCESS KEY | S3
    (1 row)

External data source options

For AWS S3
Option Valid formats Description Data type Distribution
region Text Region name String Mandatory
bucket Text Bucket name String Mandatory
accesskeyid Text AWS/IBM COS key String Optional
secretaccesskey Text AWS/IBM COS secret access key String Optional
multipartsizemb Text, fixed Multipart size; 8 MB - 5 GB String Optional
endpoint Text Region URL String Optional

Examples

See External data source examples.