Breadcrumbs

MySQL - Download Query Results to Workflows

Overview

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

Variables

Name

Reference

Type

Required

Default

Options

Description

Host

MYSQL_HOST

Alphanumeric

None

-

The domain or the IP address of the database you want to connect to.

Port

MYSQL_PORT

Integer

3306

-

Number for the database port to connect to. Defaults to 3306.

Username

MYSQL_USERNAME

Alphanumeric

None

-

Name of the user to connect to the database with.

Password

MYSQL_PASSWORD

Password

None

-

Password associated to the provided username.

Database

MYSQL_DATABASE

Alphanumeric

None

-

Name of the database in MySQL to connect to.

Extra URL Parameters

MYSQL_URL_PARAMETERS

Alphanumeric

None

-

Extra parameters that will be placed at the end of the connection string, after the "?". Must be separated by "&".

Query

MYSQL_QUERY

Alphanumeric

None

-

A SELECT statement that returns data. Formatting is ignored.

Workflows Folder Name

MYSQL_DESTINATION_FOLDER_NAME

Alphanumeric

None

-

The folder structure that you want your CSV to be created in. If left blank, the file will be created in the home directory.

Workflows File Name

MYSQL_DESTINATION_FILE_NAME

Alphanumeric

output.csv

-

The file name that you want your generated CSV to have.

Include Column Names as Header?

MYSQL_FILE_HEADER

Boolean

True

-

If checked, your CSV file will include a header row with column names.

YAML

Below is the YAML template

YAML

source:
  template: MySQL - Download Query Results to Workflows
  inputs:
    MYSQL_HOST:
    MYSQL_PORT: '3306'
    MYSQL_USERNAME:
    MYSQL_PASSWORD:
    MYSQL_DATABASE:
    MYSQL_URL_PARAMETERS:
    MYSQL_QUERY:
    MYSQL_DESTINATION_FOLDER_NAME:
    MYSQL_DESTINATION_FILE_NAME: output.csv
    MYSQL_FILE_HEADER: true
  type: TEMPLATE
guardrails:
  retry_count: 1
  retry_wait: 0h0m0s
  runtime_cutoff: 1h0m0s
  exclude_exit_code_ranges:
    - 101
    - 102
    - 200
    - 210
    - 212
    - 220
    - 221
    - 222
    - 249