PostgreSQL Query Post-run Action
Plugin version: 0.10.0
Runs a PostgreSQL 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.
The action is used whenever you need to run a query at the end of a pipeline 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 |
---|---|---|
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. Default is success. |
Driver Name | No | Required. Name of the JDBC driver to use. Default is postgresql. |
Host | Yes | Required. Host that PostgreSQL is running on. Default is localhost. |
Port | Yes | Required. Port that PostgreSQL is running on. Default is 5432. |
Database | Yes | Required. PostgreSQL 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. |
Connection Arguments | Yes | 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. |
Connection Timeout | No | Optional. The timeout value used for socket connect operations. If connecting to the server takes longer than this value, the connection is broken. The timeout is specified in seconds and a value of 0 means that it is disabled. Default is 100. |
Example
You want to delete all records from PostgreSQL table "userEvents" of database "prod" running on localhost, port 5432, without authentication using driver "postgresql" if the pipeline completes successfully. Ensure that the driver for PostgreSQL is installed. You can also driver name for some specific driver, otherwise "postgresql" will be used, and then configure the plugin with:
Property | Value |
---|---|
Driver Name |
|
Host |
|
Port |
|
Database |
|
Query |
|
Created in 2020 by Google Inc.