Skip to content

MySQL

MySQL data sources and sinks are in the database category of I/O connectors.

Tool documentation

Connector type values

The "type": value to use in the source or sink JSON files.

Connector type Value
Data Source DKDataSource_MYSQL
Data sink DKDataSink_MYSQL

Connection properties

The properties to use when connecting to a MySQL instance from Automation.

Field Scope Type Required? Description
database source/sink string yes MySQL database name.
hostname source/sink string yes MySQL host name.
password source/sink string yes MySQL password.
username source/sink string yes MySQL username.

Connections

See Connection Properties for more details on connection configurations.

Defined in kitchen-level variables

mysqlconfig in kitchen overrides

{
    "mysqlconfig": {
        "username": "#{vault://mysql/username}",
        "password": "#{vault://mysql/password}",
        "hostname": "#{vault://mysql/hostname}",
        "database": "#{vault://mysql/database}"
    }
}

The Connection tab in a Node Editor

(Screenshot of the Connection tab)

Expanded connection syntax

For a data source

mysql_datasource.json

{
    "type": "DKDataSource_MYSQL",
    "name": "mysql_datasource",
    "config": {
        "username": "{{mysqlconfig.username}}",
        "password": "{{mysqlconfig.password}}",
        "hostname": "{{mysqlconfig.hostname}}",
        "database": "{{mysqlconfig.database}}"
    },
    "keys": {},
    "tests": {}
}

For a data sink

mysql_datasink.json

{
    "type": "DKDataSink_MYSQL",
    "name": "mysql_datasink",
    "config": {
        "username": "{{mysqlconfig.username}}",
        "password": "{{mysqlconfig.password}}",
        "hostname": "{{mysqlconfig.hostname}}",
        "database": "{{mysqlconfig.database}}"
    },
    "keys": {},
    "tests": {}
}

Condensed connection syntax

Note

Note: Do not use quotes for your condensed connection configuration variables.

For a data source

mysql_datasource.json

{
    "type": "DKDataSource_MYSQL",
    "name": "mysql_datasource",
    "config-ref": "mysqlconfig",
    "keys": {},
    "tests": {}
}

For a data sink

mysql_datasink.json

{
    "type": "DKDataSource_MYSQL",
    "name": "mysql_datasink",
    "config-ref": "mysqlconfig",
    "keys": {},
    "tests": {}
}

Local connections

MySQL database contents may be viewed locally by configuring connections with IDEs like PyCharm or database query tools like DBeaver or MySQL Workbench.

Tip

Connecting PyCharm or DataGrip to MySQL: See the Database connection topic in PyCharm help for detailed information.

Other configuration properties

See the following topics for common properties and runtime variables:

File encoding requirements

Files used with data sources and data sinks must be encoded in UTF-8 in order to avoid non-Unicode characters causing problems with sinking data to database tables and errors when running related tests

For CSV and other delimited files, use Save as in the program and select the proper encoding, or consider using a text editor with encoding options.