Destinations
JDBC Destinations
JDBC destinations write to PostgreSQL, MySQL, MSSQL, or Oracle.
Providers: postgres, mysql, mssql, oracle
Output fields
Every output in this type carries these fields; provider and format values live under options.
| Field | Type | Default | Notes |
|---|---|---|---|
name (required) | string | - | - |
mode (required) | overwrite or append or upsert | - | - |
from (required) | string | - | - |
table (required) | string | - | - |
keys | array of string | - | - |
Minimal example
A complete jdbc destination with one output, written for provider postgres:
Code
Providers
postgres, mysql, mssql, oracle
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Settings options
settings.options:
| Field | Type | Default | Notes |
|---|---|---|---|
driver | string | - | The class name of the JDBC driver to use to connect to this URL. |
partitions_number | integer | - | The maximum number of partitions that can be used for parallelism in table reading and writing. Maps to numPartitions. |
query_timeout | integer | - | The number of seconds the driver will wait for a Statement object to execute. Zero means there is no limit. Maps to queryTimeout. |
keytab | string | - | Location of the kerberos keytab file for the JDBC client. |
principal | string | - | Specifies kerberos principal name for the JDBC client. |
refresh_krb5_config | boolean | - | This option controls whether the kerberos configuration is to be refreshed or not for the JDBC client before establishing a new connection. Maps to refreshKrb5Config. |
connection_provider | string | - | The name of the JDBC connection provider to use to connect to this URL, e.g. db2, mssql. Maps to connectionProvider. |
string_type | string | - | The type of string to use for the JDBC URL. Maps to stringtype. |
Output options
outputs[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
batch_size | integer | 1000 | The JDBC batch size, which determines how many rows to insert per round trip. Maps to batchsize. |
isolation_level | NONE or READ_UNCOMMITTED or READ_COMMITTED or REPEATABLE_READ or SERIALIZABLE | - | The transaction isolation level, which applies to current connection. Maps to isolationLevel. |
truncate | boolean | - | This is a JDBC writer related option. When SaveMode.Overwrite is enabled, this option causes Spark to truncate an existing table instead of dropping and recreating it. |
cascade_truncate | boolean | - | This is a JDBC writer related option. If the JDBC database supports CASCADE TRUNCATE, this option determines whether to use it. Maps to cascadeTruncate. |
create_table_options | string | - | This is a JDBC writer related option. If specified, this option allows setting of database-specific table and partition options when creating a table. Maps to createTableOptions. |
create_table_column_types | string | - | The database column data types to use instead of the defaults when creating the table. Maps to createTableColumnTypes. |
Streaming query options
These apply to every output in a streaming pipeline:
| Field | Type | Default | Notes |
|---|---|---|---|
output_mode | append or complete or update | append | Output mode of the streaming query. append: only new rows; complete: full result table; update: only updated rows (since 2.0). Maps to outputMode. |
trigger_interval | string | - | Trigger interval for processing (e.g. '10 seconds', '1 minute'). When set, uses Trigger.ProcessingTime(interval). Maps to triggerInterval. |
checkpoint_location | string | - | Optional custom checkpoint directory. When not set, a default under /app/data/spark-checkpoints/ is used. Maps to checkpointLocation. |
query_name | string | - | Name for the streaming query (for monitoring and debugging). Maps to queryName. |
Related pages
Last modified on