MySQL Query Post-run Action

Plugin version: 1.10.0

Runs a MySQL query at the end of the pipeline run. Can be configured to run only on success, only on failure, or always at the end of the run. For example, you might have a pipeline that imports data from a database table to HDFS files. At the end of the run, you might want to run a query that deletes the data that was read from the table.

Configuration

Property

Macro Enabled?

Description

Property

Macro Enabled?

Description

Run Condition

Yes

Optional. When to run the action. Must be 'completion', 'success', or 'failure'. Defaults to 'success'. If set to 'completion', the action will be executed regardless of whether the pipeline run succeeded or failed. If set to 'success', the action will only be executed if the pipeline run succeeded. If set to 'failure', the action will only be executed if the pipeline run failed.

Driver Name

No

Required. Name of the JDBC driver to use.

Default is mysql.

Host

Yes

Required. Host that MySQL is running on.

Default is localhost.

Port

Yes

Required. Port that MySQL is running on.

Default is 3306.

Database

Yes

Required. MySQL database name.

Query

Yes

Required. Query to run.

Username

Yes

Optional. User identity for connecting to the specified database.

Password

Yes

Optional. Password to use to connect to the specified database.

Use SSL

No

Optional. Turns on SSL encryption. The connection will fail if SSL is not available.

Default is If available.

Keystore URL

No

Optional. URL to the client certificate KeyStore (if not specified, use defaults). Must be accessible at the same location on host where CDAP Master is running and all hosts on which at least one HDFS, MapReduce, or YARN daemon role is running.

Keystore Password

No

Optional. Password for the client certificates KeyStore.

Truststore URL

No

Optional. URL to the trusted root certificate KeyStore (if not specified, use defaults). Must be accessible at the same location on host where CDAP Master is running and all hosts on which at least one HDFS, MapReduce, or YARN daemon role is running.

Truststore Password

No

Optional. Password for the trusted root certificates KeyStore.

Use Compression

No

Optional. Use zlib compression when communicating with the server. Select this option for WAN connections.

Default is No.

Use ANSI SQL Quotes

No

Optional. Treats " as an identifier quote character and not as a string quote character.

Default is No.

SQL Mode

No

Optional. Override the default SQL_MODE session variable used by the server.

Connection Arguments

No

Optional. A list of arbitrary string key/value pairs as connection arguments. These arguments will be passed to the JDBC driver as connection arguments for JDBC drivers that may need additional configurations.

Auto Reconnect

No

Optional. Should the driver try to re-establish stale and/or dead connections.

Default is No.

Example

Suppose you want to delete all records from MySQL table "userEvents" of database "prod" running on localhost, port 3306, without authentication using driver "mariadb" if the pipeline completes successfully Ensure that the driver for MySQL is installed. You can also driver name for some specific driver, otherwise "mysql" will be used, and then configure the plugin with:

Property

Value

Property

Value

Run Condition

success

Driver Name

mariadb

Host

localhost

Port

3306

Database

prod

Query

delete * from userEvents

 

Created in 2020 by Google Inc.