Creating an OBS Foreign Table
- Based on the path planned in Planning Data Export, determine the value of the location parameter used for creating a foreign table.
- Obtain the access keys (AK and SK) to access OBS.
To obtain access keys, log in to the management console, click the username in the upper right corner, and select My Credential from the menu. Then choose Access Keys in the navigation tree on the left. On the Access Keys page, you can view the existing AKs or click Add Access Key to create and download access keys.
- Examine the formats of data to be exported and determine the values of data format parameters used for creating a foreign table. For details, see data format parameters.
- Create an OBS table based on the parameter settings in the preceding steps. For details about how to create a foreign table, see CREATE FOREIGN TABLE (for GDS Import and Export).
Create a foreign table in the GaussDB(DWS) database. Set parameters as follows:
For example, set location as follows:
- Access keys (AK and SK)
- Set access_key to the AK you have obtained.
- Set secret_access_key to the SK you have obtained.
access_key and secret_access_key have been obtained during user creation. Replace the italic part with the actual keys.
- Data format parameters
- Set format to CSV.
- Set encoding to UTF-8.
- Configure encrypt. Its default value is off.
- Set delimiter to ,.
- Set header (whether the exported data file contains the header row).
Specifies whether a file contains a header with the names of each column in the file.
When exporting data from OBS, this parameter cannot be set to true. Use the default value false, indicating that the first row of the exported data file is not the header.
Based on the preceding settings, the foreign table is created using the following statements:
If the following information is displayed, the foreign table has been created:
CREATE FOREIGN TABLE