public static class JdbcIO.Write<T> extends PTransform<PCollection<T>,PDone>
JdbcIO.write()
.
All methods in this class delegate to the appropriate method of JdbcIO.WriteVoid
.
name, resourceHints
Modifier and Type | Method and Description |
---|---|
PDone |
expand(PCollection<T> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
JdbcIO.Write<T> |
withAutoSharding()
|
JdbcIO.Write<T> |
withBatchSize(long batchSize)
|
JdbcIO.Write<T> |
withDataSourceConfiguration(JdbcIO.DataSourceConfiguration config)
See
WriteVoid#withDataSourceConfiguration(DataSourceConfiguration) . |
JdbcIO.Write<T> |
withDataSourceProviderFn(SerializableFunction<java.lang.Void,javax.sql.DataSource> dataSourceProviderFn)
|
JdbcIO.Write<T> |
withPreparedStatementSetter(JdbcIO.PreparedStatementSetter<T> setter)
See
WriteVoid#withPreparedStatementSetter(PreparedStatementSetter) . |
JdbcIO.WriteVoid<T> |
withResults()
Returns
JdbcIO.WriteVoid transform which can be used in Wait.on(PCollection[]) to
wait until all data is written. |
JdbcIO.Write<T> |
withRetryConfiguration(JdbcIO.RetryConfiguration retryConfiguration)
See
WriteVoid#withRetryConfiguration(RetryConfiguration) . |
JdbcIO.Write<T> |
withRetryStrategy(JdbcIO.RetryStrategy retryStrategy)
See
WriteVoid#withRetryStrategy(RetryStrategy) . |
JdbcIO.Write<T> |
withStatement(java.lang.String statement)
|
JdbcIO.Write<T> |
withTable(java.lang.String table)
|
<V extends JdbcWriteResult> |
withWriteResults(JdbcIO.RowMapper<V> rowMapper)
Returns
JdbcIO.WriteWithResults transform that could return a specific result. |
compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setResourceHints, toString, validate
public JdbcIO.Write<T> withAutoSharding()
public JdbcIO.Write<T> withDataSourceConfiguration(JdbcIO.DataSourceConfiguration config)
WriteVoid#withDataSourceConfiguration(DataSourceConfiguration)
.public JdbcIO.Write<T> withDataSourceProviderFn(SerializableFunction<java.lang.Void,javax.sql.DataSource> dataSourceProviderFn)
public JdbcIO.Write<T> withStatement(java.lang.String statement)
public JdbcIO.Write<T> withPreparedStatementSetter(JdbcIO.PreparedStatementSetter<T> setter)
WriteVoid#withPreparedStatementSetter(PreparedStatementSetter)
.public JdbcIO.Write<T> withBatchSize(long batchSize)
public JdbcIO.Write<T> withRetryStrategy(JdbcIO.RetryStrategy retryStrategy)
WriteVoid#withRetryStrategy(RetryStrategy)
.public JdbcIO.Write<T> withRetryConfiguration(JdbcIO.RetryConfiguration retryConfiguration)
WriteVoid#withRetryConfiguration(RetryConfiguration)
.public JdbcIO.Write<T> withTable(java.lang.String table)
public JdbcIO.WriteVoid<T> withResults()
JdbcIO.WriteVoid
transform which can be used in Wait.on(PCollection[])
to
wait until all data is written.
Example: write a PCollection
to one database and then to another database, making
sure that writing a window of data to the second database starts only after the respective
window has been fully written to the first database.
PCollection<Void> firstWriteResults = data.apply(JdbcIO.write()
.withDataSourceConfiguration(CONF_DB_1).withResults());
data.apply(Wait.on(firstWriteResults))
.apply(JdbcIO.write().withDataSourceConfiguration(CONF_DB_2));
public <V extends JdbcWriteResult> JdbcIO.WriteWithResults<T,V> withWriteResults(JdbcIO.RowMapper<V> rowMapper)
JdbcIO.WriteWithResults
transform that could return a specific result.
public void populateDisplayData(DisplayData.Builder builder)
PTransform
populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect
display data via DisplayData.from(HasDisplayData)
. Implementations may call super.populateDisplayData(builder)
in order to register display data in the current namespace,
but should otherwise use subcomponent.populateDisplayData(builder)
to use the namespace
of the subcomponent.
By default, does not register any display data. Implementors may override this method to provide their own display data.
populateDisplayData
in interface HasDisplayData
populateDisplayData
in class PTransform<PCollection<T>,PDone>
builder
- The builder to populate with display data.HasDisplayData
public PDone expand(PCollection<T> input)
PTransform
PTransform
should be expanded on the given
InputT
.
NOTE: This method should not be called directly. Instead apply the PTransform
should
be applied to the InputT
using the apply
method.
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
expand
in class PTransform<PCollection<T>,PDone>