Skip to main content

PostgreSQL - Download Query Results to Shipyard

Overview​

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

Variables​

NameReferenceTypeRequiredDefaultOptionsDescription
HostPOSTGRES_HOSTAlphanumericβœ…--The domain or the IP address of the database you want to connect to.
PortPOSTGRES_PORTIntegerβœ…"5432"-Number for the database port to connect to. Defaults to 5432.
UsernamePOSTGRES_USERNAMEAlphanumericβœ…--Name of the user to connect to the database with.
PasswordPOSTGRES_PASSWORDPasswordβž–--Password associated to the provided username.
DatabasePOSTGRES_DATABASEAlphanumericβœ…--Name of the database in PostgreSQL to connect to.
Extra URL ParametersPOSTGRES_URL_PARAMETERSAlphanumericβž–--Extra parameters that will be placed at the end of the connection string, after the "?". Must be separated by "&".
QueryPOSTGRES_QUERYAlphanumericβœ…--A SELECT statement that returns data. Formatting is ignored.
Shipyard Folder NamePOSTGRES_DESTINATION_FOLDER_NAMEAlphanumericβž–--The folder structure that you want your CSV to be created in. If left blank, the file will be created in the home directory.
Shipyard File NamePOSTGRES_DESTINATION_FILE_NAMEAlphanumericβœ…output.csv-The file name that you want your generated CSV to have.
Include Column Names as Header?POSTGRES_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: PostgreSQL - Download Query Results to Shipyard
inputs:
POSTGRES_HOST: null ## REQUIRED
POSTGRES_PORT: '5432' ## REQUIRED
POSTGRES_USERNAME: null ## REQUIRED
POSTGRES_PASSWORD: null
POSTGRES_DATABASE: null ## REQUIRED
POSTGRES_URL_PARAMETERS: null
POSTGRES_QUERY: null ## REQUIRED
POSTGRES_DESTINATION_FOLDER_NAME: null
POSTGRES_DESTINATION_FILE_NAME: output.csv ## REQUIRED
POSTGRES_FILE_HEADER: true ## REQUIRED
type: BLUEPRINT
guardrails:
retry_count: 1
retry_wait: 0h0m0s
runtime_cutoff: 1h0m0s
exclude_exit_code_ranges:
- '200'
- '220'
- '221'
- '222'
- '249'