Amazon Redshift
Table of Contents
- Getting Started
- Capabilities
- Settings
-
Host (
host
) -
Port (
port
) -
Database Name (
dbname
) -
User name (
user
) -
Password (
password
) -
S3 Bucket name (
s3_bucket
) -
Default Target Schema (
default_target_schema
) -
AWS Profile Name (
aws_profile
) -
AWS S3 Access Key ID (
aws_access_key_id
) -
AWS S3 Secret Access Key (
aws_secret_access_key
) -
AWS S3 Session Token (
aws_session_token
) -
AWS Redshift COPY role ARN (
aws_redshift_copy_role_arn
) -
AWS S3 ACL (
s3_acl
) -
S3 Key Prefix (
s3_key_prefix
) -
COPY options (
copy_options
) -
Batch Size Rows (
batch_size_rows
) -
Flush All Streams (
flush_all_streams
) -
Parallelism (
parallelism
) -
Max Parallelism (
max_parallelism
) -
Default Target Schema Select Permission (
default_target_schema_select_permissions
) -
Scema Mapping (
schema_mapping
) -
Disable Table Cache (
disable_table_cache
) -
Add Metdata Columns (
add_metadata_columns
) -
Hard Delete (
hard_delete
) -
Data Flattening Max Level (
data_flattening_max_level
) -
Primary Key Required (
primary_key_required
) -
Validate Records (
validate_records
) -
Skip Updates (
skip_updates
) -
Compression (
compression
) -
Slices (
slices
) -
Temp Directory (
temp_dir
)
-
Host (
- Looking for help?
The target-redshift
Meltano loader sends data into Amazon Redshift after it was pulled from a source using an extractor.
-
- Repository: https://github.com/transferwise/pipelinewise-target-redshift
-
-
-
-
-
-
-
- Maintainer: Wise
- Meltano Stats:
-
-
-
-
Getting Started #
Prerequisites #
If you haven't already, follow the initial steps of the Getting Started guide:
Installation and configuration #
-
Add the
target-redshift
loader to your project usingmeltano add
:meltano add loader target-redshift
-
Configure the settings below using
meltano config
.
Next steps #
Follow the remaining steps of the Getting Started guide:
If you run into any issues, learn how to get help.Capabilities #
Settings #
target-redshift
requires the
configuration
of one of the following groups of settings:
-
host
port
user
password
dbname
s3_bucket
default_target_schema
aws_profile
-
host
port
user
password
dbname
s3_bucket
default_target_schema
aws_access_key_id
aws_secret_access_key
-
host
port
user
password
dbname
s3_bucket
default_target_schema
aws_session_token
The settings for loader target-redshift
that are known to Meltano are documented below.
To quickly find the
setting you're looking for, use the Table of Contents at
the top of the page.
Host (host
)
#
-
Environment variable:
TARGET_REDSHIFT_HOST
Redshift host
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set host <host>
export TARGET_REDSHIFT_HOST=<host>
Port (port
)
#
-
Environment variable:
TARGET_REDSHIFT_PORT
- Default:
5439
Redshift port
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set port 5439
export TARGET_REDSHIFT_PORT=5439
Database Name (dbname
)
#
-
Environment variable:
TARGET_REDSHIFT_DBNAME
Redshift database name
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set dbname <dbname>
export TARGET_REDSHIFT_DBNAME=<dbname>
User name (user
)
#
-
Environment variable:
TARGET_REDSHIFT_USER
Redshift user name
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set user <user>
export TARGET_REDSHIFT_USER=<user>
Password (password
)
#
-
Environment variable:
TARGET_REDSHIFT_PASSWORD
Redshift password
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set password <password>
export TARGET_REDSHIFT_PASSWORD=<password>
S3 Bucket name (s3_bucket
)
#
-
Environment variable:
TARGET_REDSHIFT_S3_BUCKET
AWS S3 bucket name
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set s3_bucket <s3_bucket>
export TARGET_REDSHIFT_S3_BUCKET=<s3_bucket>
Default Target Schema (default_target_schema
)
#
-
Environment variable:
TARGET_REDSHIFT_DEFAULT_TARGET_SCHEMA
- Default:
$MELTANO_EXTRACT__LOAD_SCHEMA
Note $MELTANO_EXTRACT__LOAD_SCHEMA
will expand to the value of the load_schema
extra for the extractor used in the pipeline, which defaults to the extractor’s namespace, e.g. tap_gitlab
for tap-gitlab
.
Name of the schema where the tables will be created. If schema_mapping
is not defined then every stream sent by the tap is loaded into this schema.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set default_target_schema <default_target_schema>
export TARGET_REDSHIFT_DEFAULT_TARGET_SCHEMA=<default_target_schema>
AWS Profile Name (aws_profile
)
#
-
Environment variable:
TARGET_REDSHIFT_AWS_PROFILE
AWS profile name for profile based authentication. If not provided, AWS_PROFILE
environment variable will be used.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set aws_profile <aws_profile>
export TARGET_REDSHIFT_AWS_PROFILE=<aws_profile>
AWS S3 Access Key ID (aws_access_key_id
)
#
-
Environment variable:
TARGET_REDSHIFT_AWS_ACCESS_KEY_ID
S3 Access Key Id. Used for S3 and Redshift copy operations. If not provided, AWS_ACCESS_KEY_ID
environment variable will be used.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set aws_access_key_id <aws_access_key_id>
export TARGET_REDSHIFT_AWS_ACCESS_KEY_ID=<aws_access_key_id>
AWS S3 Secret Access Key (aws_secret_access_key
)
#
-
Environment variable:
TARGET_REDSHIFT_AWS_SECRET_ACCESS_KEY
S3 Secret Access Key. Used for S3 and Redshift copy operations. If not provided, AWS_SECRET_ACCESS_KEY
environment variable will be used.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set aws_secret_access_key <aws_secret_access_key>
export TARGET_REDSHIFT_AWS_SECRET_ACCESS_KEY=<aws_secret_access_key>
AWS S3 Session Token (aws_session_token
)
#
-
Environment variable:
TARGET_REDSHIFT_AWS_SESSION_TOKEN
S3 AWS STS token for temporary credentials. If not provided, AWS_SESSION_TOKEN
environment variable will be used.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set aws_session_token <aws_session_token>
export TARGET_REDSHIFT_AWS_SESSION_TOKEN=<aws_session_token>
AWS Redshift COPY role ARN (aws_redshift_copy_role_arn
)
#
-
Environment variable:
TARGET_REDSHIFT_AWS_REDSHIFT_COPY_ROLE_ARN
AWS Role ARN to be used for the Redshift COPY operation. Used instead of the given AWS keys for the COPY operation if provided - the keys are still used for other S3 operations
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set aws_redshift_copy_role_arn <aws_redshift_copy_role_arn>
export TARGET_REDSHIFT_AWS_REDSHIFT_COPY_ROLE_ARN=<aws_redshift_copy_role_arn>
AWS S3 ACL (s3_acl
)
#
-
Environment variable:
TARGET_REDSHIFT_S3_ACL
S3 Object ACL
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set s3_acl <s3_acl>
export TARGET_REDSHIFT_S3_ACL=<s3_acl>
S3 Key Prefix (s3_key_prefix
)
#
-
Environment variable:
TARGET_REDSHIFT_S3_KEY_PREFIX
A static prefix before the generated S3 key names. Using prefixes you can upload files into specific directories in the S3 bucket. Default(None)
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set s3_key_prefix <s3_key_prefix>
export TARGET_REDSHIFT_S3_KEY_PREFIX=<s3_key_prefix>
COPY options (copy_options
)
#
-
Environment variable:
TARGET_REDSHIFT_COPY_OPTIONS
- Default:
EMPTYASNULL BLANKSASNULL TRIMBLANKS TRUNCATECOLUMNS TIMEFORMAT 'auto' COMPUPDATE OFF STATUPDATE OFF
Parameters to use in the COPY command when loading data to Redshift.
Some basic file formatting parameters are fixed values and not recommended overriding them by custom values.
They are like: CSV GZIP DELIMITER ',' REMOVEQUOTES ESCAPE
.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set copy_options <copy_options>
export TARGET_REDSHIFT_COPY_OPTIONS=<copy_options>
Batch Size Rows (batch_size_rows
)
#
-
Environment variable:
TARGET_REDSHIFT_BATCH_SIZE_ROWS
- Default:
100000
Maximum number of rows in each batch. At the end of each batch, the rows in the batch are loaded into Redshift.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set batch_size_rows 100000
export TARGET_REDSHIFT_BATCH_SIZE_ROWS=100000
Flush All Streams (flush_all_streams
)
#
-
Environment variable:
TARGET_REDSHIFT_FLUSH_ALL_STREAMS
- Default:
false
Flush and load every stream into Redshift when one batch is full. Warning - This may trigger the COPY command to use files with low number of records, and may cause performance problems.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set flush_all_streams true
export TARGET_REDSHIFT_FLUSH_ALL_STREAMS=true
Parallelism (parallelism
)
#
-
Environment variable:
TARGET_REDSHIFT_PARALLELISM
- Default:
0
The number of threads used to flush tables. 0 will create a thread for each stream, up to parallelism_max. -1 will create a thread for each CPU core. Any other positive number will create that number of threads, up to parallelism_max.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set parallelism 0
export TARGET_REDSHIFT_PARALLELISM=0
Max Parallelism (max_parallelism
)
#
-
Environment variable:
TARGET_REDSHIFT_MAX_PARALLELISM
- Default:
16
Max number of parallel threads to use when flushing tables.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set max_parallelism 16
export TARGET_REDSHIFT_MAX_PARALLELISM=16
Default Target Schema Select Permission (default_target_schema_select_permissions
)
#
-
Environment variable:
TARGET_REDSHIFT_DEFAULT_TARGET_SCHEMA_SELECT_PERMISSIONS
Grant USAGE privilege on newly created schemas and grant SELECT privilege on newly created tables to a specific list of users or groups. If schema_mapping
is not defined then every stream sent by the tap is granted accordingly.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set default_target_schema_select_permissions <default_target_schema_select_permissions>
export TARGET_REDSHIFT_DEFAULT_TARGET_SCHEMA_SELECT_PERMISSIONS=<default_target_schema_select_permissions>
Scema Mapping (schema_mapping
)
#
-
Environment variable:
TARGET_REDSHIFT_SCHEMA_MAPPING
Useful if you want to load multiple streams from one tap to multiple Redshift schemas.
If the tap sends the stream_id
in <schema_name>-<table_name>
format then this option overwrites the default_target_schema
value.
Note, that using schema_mapping
you can overwrite the default_target_schema_select_permissions
value to grant SELECT permissions to different groups per schemas or optionally
you can create indices automatically for the replicated tables.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set schema_mapping '{...}'
export TARGET_REDSHIFT_SCHEMA_MAPPING='{...}'
Disable Table Cache (disable_table_cache
)
#
-
Environment variable:
TARGET_REDSHIFT_DISABLE_TABLE_CACHE
- Default:
false
By default the connector caches the available table structures in Redshift at startup. In this way it doesn’t need to run additional queries when ingesting data to check if altering the target tables is required. With disable_table_cache
option you can turn off this caching. You will always see the most recent table structures but will cause an extra query runtime.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set disable_table_cache true
export TARGET_REDSHIFT_DISABLE_TABLE_CACHE=true
Add Metdata Columns (add_metadata_columns
)
#
-
Environment variable:
TARGET_REDSHIFT_ADD_METADATA_COLUMNS
- Default:
false
Metadata columns add extra row level information about data ingestions,
(i.e. when was the row read in source, when was inserted or deleted in redshift
etc.) Metadata columns are creating automatically by adding extra columns to the
tables with a column prefix _SDC_
.
The metadata columns are documented at https://transferwise.github.io/pipelinewise/data_structure/sdc-columns.html. Enabling metadata columns will flag the deleted rows by setting the _SDC_DELETED_AT metadata column.
Without the add_metadata_columns
option the deleted rows from
singer taps will not be recongisable in Redshift.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set add_metadata_columns true
export TARGET_REDSHIFT_ADD_METADATA_COLUMNS=true
Hard Delete (hard_delete
)
#
-
Environment variable:
TARGET_REDSHIFT_HARD_DELETE
- Default:
false
When hard_delete
option is true then DELETE SQL commands will be performed in Redshift to delete rows in tables. It’s achieved by continuously checking the _SDC_DELETED_AT
metadata column sent by the singer tap. Due to deleting rows requires metadata columns, hard_delete
option automatically enables the add_metadata_columns
option as well.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set hard_delete true
export TARGET_REDSHIFT_HARD_DELETE=true
Data Flattening Max Level (data_flattening_max_level
)
#
-
Environment variable:
TARGET_REDSHIFT_DATA_FLATTENING_MAX_LEVEL
- Default:
0
Object type RECORD
items from taps can be loaded into VARIANT columns as JSON (default) or we can flatten the schema by creating columns automatically. When value is 0 (default) then flattening functionality is turned off.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set data_flattening_max_level 0
export TARGET_REDSHIFT_DATA_FLATTENING_MAX_LEVEL=0
Primary Key Required (primary_key_required
)
#
-
Environment variable:
TARGET_REDSHIFT_PRIMARY_KEY_REQUIRED
- Default:
true
Log based and Incremental replications on tables with no Primary Key cause duplicates when merging UPDATE events. When set to true, stop loading data if no Primary Key is defined.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set primary_key_required false
export TARGET_REDSHIFT_PRIMARY_KEY_REQUIRED=false
Validate Records (validate_records
)
#
-
Environment variable:
TARGET_REDSHIFT_VALIDATE_RECORDS
- Default:
false
Validate every single record message to the corresponding JSON schema. This option is disabled by default and invalid RECORD
messages will fail only at load time by Redshift. Enabling this option will detect invalid records earlier but could cause performance degradation.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set validate_records true
export TARGET_REDSHIFT_VALIDATE_RECORDS=true
Skip Updates (skip_updates
)
#
-
Environment variable:
TARGET_REDSHIFT_SKIP_UPDATES
- Default:
false
Do not update existing records when Primary Key is defined. Useful to improve performance when records are immutable, e.g. events
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set skip_updates true
export TARGET_REDSHIFT_SKIP_UPDATES=true
Compression (compression
)
#
-
Environment variable:
TARGET_REDSHIFT_COMPRESSION
-
Options:
gzip
bzip2
The compression method to use when writing files to S3 and running Redshift COPY.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set compression gzip
export TARGET_REDSHIFT_COMPRESSION=gzip
Slices (slices
)
#
-
Environment variable:
TARGET_REDSHIFT_SLICES
- Default:
1
The number of slices to split files into prior to running COPY on Redshift. This should be set to the number of Redshift slices. The number of slices per node depends on the node size of the cluster - run SELECT COUNT(DISTINCT slice) slices FROM stv_slices to calculate this. Defaults to 1.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set slices 1
export TARGET_REDSHIFT_SLICES=1
Temp Directory (temp_dir
)
#
-
Environment variable:
TARGET_REDSHIFT_TEMP_DIR
(Default: platform-dependent) Directory of temporary CSV files with RECORD messages.
How to use #
Manage this setting using
meltano config
or an
environment variable:
meltano config target-redshift set temp_dir <temp_dir>
export TARGET_REDSHIFT_TEMP_DIR=<temp_dir>
Looking for help? #
If you're having trouble getting the
target-redshift
loader to work, look for an
existing issue in its repository, file a new issue,
or
join the Meltano Slack community
and ask for help in the #plugins-general
channel.
Found an issue on this page? #
This page is generated from a YAML file that you can contribute changes to. Edit it on GitHub!