Skip to main content

Amazon Redshift - Store Query Results as CSV

Overview​

First time using this Blueprint? Make sure you follow our Redshift authorization guide.​

Turn the results of your SQL SELECT statement into a CSV file. Extract your Amazon Redshift data into files for easier delivery to clients and partners.

Variables​

NameReferenceTypeRequiredDefaultOptionsDescription
HostREDSHIFT_HOSTAlphanumericβœ…--The domain or the IP address of the database you want to connect to.
PortREDSHIFT_PORTIntegerβœ…5439-Port number where the database accepts inbound connections.
UsernameREDSHIFT_USERNAMEAlphanumericβœ…--Username configured as part of the database credentials. See Authorization documentation for more information.
PasswordREDSHIFT_PASSWORDPasswordβž–--Password for the provided username
DatabaseREDSHIFT_DATABASEAlphanumericβœ…--Name of the database to connect to.
Extra URL ParametersREDSHIFT_URL_PARAMETERSAlphanumericβž–--Extra parameters that will be placed at the end of the connection string, after the "?". Must be separated by "&"
QueryREDSHIFT_QUERYAlphanumericβœ…--A SELECT statement that returns data. Formatting is ignored
Folder NameREDSHIFT_DESTINATION_FOLDER_NAMEAlphanumericβž–--Folder where the file will be created. Leave blank to store in the current working directory
File NameREDSHIFT_DESTINATION_FILE_NAMEAlphanumericβœ…output.csv-File name that will be created with the results of the query
Include Column Names as Header?REDSHIFT_FILE_HEADERBooleanβœ…true-If checked, your CSV file will include a header row with column names.

YAML​

Below is the YAML template for this Blueprint and can be used in the Fleet YAML Editor.

source:
blueprint: Amazon Redshift - Store Query Results as CSV
inputs:
REDSHIFT_HOST: null ## REQUIRED
REDSHIFT_PORT: 5439 ## REQUIRED
REDSHIFT_USERNAME: null ## REQUIRED
REDSHIFT_PASSWORD: null
REDSHIFT_DATABASE: null ## REQUIRED
REDSHIFT_URL_PARAMETERS: null
REDSHIFT_QUERY: null ## REQUIRED
REDSHIFT_DESTINATION_FOLDER_NAME: null
REDSHIFT_DESTINATION_FILE_NAME: output.csv ## REQUIRED
REDSHIFT_FILE_HEADER: true ## REQUIRED
type: BLUEPRINT
guardrails:
retry_count: 1
retry_wait: 0s
runtime_cutoff: 4h0m0s
exclude_exit_code_ranges:
- "0"