Database Action

Plugin version: 2.11.0

Action that runs a database command.

The action can be used whenever you want to run a database command before or after a data pipeline. For example, you may want to run an SQL update command on a database before the pipeline source reads data from tables.

Configuration

Property

Macro Enabled?

Description

Property

Macro Enabled?

Description

Plugin Name

No

Required. Name of the JDBC plugin to use. This is the value of the ‘name’ key defined in the JSON file for the JDBC plugin.

Plugin Type

No

Optional. Type of the JDBC plugin to use. This is the value of the ‘type’ key defined in the JSON file for the JDBC plugin.

Default is ‘jdbc’.

Connection String

Yes

Required. JDBC connection string including database name.

Database Command

Yes

Required. The database command to execute.

Username

Yes

Optional. User identity for connecting to the specified database. Required for databases that need authentication. Optional for databases that do not require authentication.

Password

Yes

Optional. Password to use to connect to the specified database. Required for databases that need authentication. Optional for databases that do not require authentication.

Connection Arguments

Yes

Optional. A list of arbitrary string tag/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. This is a semicolon-separated list of key-value pairs, where each pair is separated by a equals ‘=’ and specifies the key and value for the argument. For example, ‘key1=value1;key2=value’ specifies that the connection will be given arguments ‘key1’ mapped to ‘value1’ and the argument ‘key2’ mapped to ‘value2’.

Enable Auto-Commit

No

Optional. Whether to enable auto-commit for queries run by this source. In most cases, set to false. If you use a JDBC driver that results in an error when the commit operation is run, set to true.

Default is false.

Example

This example connects to a database using the specified Connection String, which means it will connect to the prod database of a PostgreSQL instance running on ‘localhost’. It will run an update command to set the price of record with ID 6 to 20.

Property

Value

Property

Value

Plugin Name

postgres

Plugin Type

jdbc

Connection String

jdbc:postgresql://localhost:5432/prod

Database Command

UPDATE table_name SET price = 20 WHERE ID = 6

Username

user123

Password

password-abc

 

Created in 2020 by Google Inc.