public abstract static class JdbcIO.WriteVoid<T>
extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<T>,org.apache.beam.sdk.values.PCollection<java.lang.Void>>
PTransform to write to a JDBC datasource.| Constructor and Description |
|---|
WriteVoid() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.beam.sdk.values.PCollection<java.lang.Void> |
expand(org.apache.beam.sdk.values.PCollection<T> input) |
JdbcIO.WriteVoid<T> |
withBatchSize(long batchSize)
Provide a maximum size in number of SQL statement for the batch.
|
JdbcIO.WriteVoid<T> |
withDataSourceConfiguration(JdbcIO.DataSourceConfiguration config) |
JdbcIO.WriteVoid<T> |
withDataSourceProviderFn(org.apache.beam.sdk.transforms.SerializableFunction<java.lang.Void,javax.sql.DataSource> dataSourceProviderFn) |
JdbcIO.WriteVoid<T> |
withPreparedStatementSetter(JdbcIO.PreparedStatementSetter<T> setter) |
JdbcIO.WriteVoid<T> |
withRetryConfiguration(JdbcIO.RetryConfiguration retryConfiguration)
When a SQL exception occurs,
JdbcIO.Write uses this JdbcIO.RetryConfiguration to
exponentially back off and retry the statements based on the JdbcIO.RetryConfiguration
mentioned. |
JdbcIO.WriteVoid<T> |
withRetryStrategy(JdbcIO.RetryStrategy retryStrategy)
When a SQL exception occurs,
JdbcIO.Write uses this JdbcIO.RetryStrategy to determine if it
will retry the statements. |
JdbcIO.WriteVoid<T> |
withStatement(java.lang.String statement) |
JdbcIO.WriteVoid<T> |
withStatement(org.apache.beam.sdk.options.ValueProvider<java.lang.String> statement) |
JdbcIO.WriteVoid<T> |
withTable(java.lang.String table) |
public JdbcIO.WriteVoid<T> withDataSourceConfiguration(JdbcIO.DataSourceConfiguration config)
public JdbcIO.WriteVoid<T> withDataSourceProviderFn(org.apache.beam.sdk.transforms.SerializableFunction<java.lang.Void,javax.sql.DataSource> dataSourceProviderFn)
public JdbcIO.WriteVoid<T> withStatement(java.lang.String statement)
public JdbcIO.WriteVoid<T> withStatement(org.apache.beam.sdk.options.ValueProvider<java.lang.String> statement)
public JdbcIO.WriteVoid<T> withPreparedStatementSetter(JdbcIO.PreparedStatementSetter<T> setter)
public JdbcIO.WriteVoid<T> withBatchSize(long batchSize)
batchSize - maximum batch size in number of statementspublic JdbcIO.WriteVoid<T> withRetryStrategy(JdbcIO.RetryStrategy retryStrategy)
JdbcIO.Write uses this JdbcIO.RetryStrategy to determine if it
will retry the statements. If JdbcIO.RetryStrategy.apply(SQLException) returns true,
then JdbcIO.Write retries the statements.public JdbcIO.WriteVoid<T> withRetryConfiguration(JdbcIO.RetryConfiguration retryConfiguration)
JdbcIO.Write uses this JdbcIO.RetryConfiguration to
exponentially back off and retry the statements based on the JdbcIO.RetryConfiguration
mentioned.
Usage of RetryConfiguration -
pipeline.apply(JdbcIO.<T>write())
.withDataSourceConfiguration(...)
.withRetryStrategy(...)
.withRetryConfiguration(JdbcIO.RetryConfiguration.
create(5, Duration.standardSeconds(5), Duration.standardSeconds(1))
maxDuration and initialDuration are Nullable
pipeline.apply(JdbcIO.<T>write())
.withDataSourceConfiguration(...)
.withRetryStrategy(...)
.withRetryConfiguration(JdbcIO.RetryConfiguration.
create(5, null, null)
public JdbcIO.WriteVoid<T> withTable(java.lang.String table)