The Unload command options extract data from Amazon Redshift and load data to staging files on Amazon S3 in a particular format. You can delimit the data with a particular character or load data to multiple files in parallel.
To add options to the Unload command, use the
Unload Options
option.
You can set the following options:
DELIMITER
A single ASCII character to separate fields in the input file. You can use characters such as pipe (|), tilde (~), or a tab (\t). The delimiter you specify must not be a part of the data. If the delimiter is a part of data, use ESCAPE to read the delimiter character as a regular character.
The default value is \036 which represents the octal representation of the non-printable known as the record separator.
It is recommended to use octal representation of non-printable characters as DELIMITER.
ESCAPE
You can add an escape character for CHAR and VARCHAR columns in delimited unload files before the delimiter character is specified for the unloaded data. By default, the escape option is
ON
. To disable the escape option, specify
OFF
as the value of the escape option. For example,
ESCAPE=OFF
.
If you enable the optimization property that you set for staging data, you must use
ESCAPE=OFF
in Unload command options. If you do not specify
ESCAPE=OFF
, the mapping runs without optimizing the staging performance.
REGION
You can use the REGION attribute when the Amazon S3 staging bucket is not in the same region as the cluster region. If Amazon Redshift resides in the US East (N. Virginia) region, you can use an Amazon S3 bucket residing in the Asia Pacific (Mumbai) region to create staging files. For example,
REGION = ap-south-1
.
PARALLEL
The Unload command writes data in parallel to multiple files, according to the number of slices in the cluster. Default is on. If you turn the Parallel option off, the Unload command writes data serially. The maximum size of a data file is 6.5 GB.
NULL
You can use NULL Unload command option to replace the null values in an Amazon Redshift source table with the string that you specify using the NULL Unload command option.
Enter the value of the NULL Unload command option in the following format:
NULL=text
. Do not add spaces when you enter the string value.
The NULL Unload command option does not apply to mappings in advanced mode.
For more information about the NULL Unload command, see the AWS documentation.
AWS_IAM_ROLE
Specify the Amazon Redshift Role Resource Name (ARN) to run the mapping on Secure Agent installed on an Amazon EC2 system in the following format:
ADDQUOTES is implemented with the UNLOAD command by default. The Unload command adds quotation marks to each data field. With added quotation marks, the UNLOAD command can read data values that contain the delimiter. If double quote (") is a part of data, use ESCAPE to read the double quote as a regular character.