Java Code Examples for org.apache.beam.sdk.io.jdbc.JdbcIO#RowMapper

The following examples show how to use org.apache.beam.sdk.io.jdbc.JdbcIO#RowMapper . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamicJdbcIO.java    From DataflowTemplates with Apache License 2.0 5 votes vote down vote up
private DynamicReadFn(
    DynamicDataSourceConfiguration dataSourceConfiguration,
    ValueProvider<String> query,
    JdbcIO.RowMapper<T> rowMapper) {
  this.dataSourceConfiguration = dataSourceConfiguration;
  this.query = query;
  this.rowMapper = rowMapper;
}
 
Example 2
Source File: JdbcConvertersTest.java    From DataflowTemplates with Apache License 2.0 5 votes vote down vote up
@Test
public void testRowMapper() throws Exception {

    JdbcIO.RowMapper<TableRow> resultSetConverters = JdbcConverters.getResultSetToTableRow();
    TableRow actualTableRow = resultSetConverters.mapRow(resultSet);

    assertThat(expectedTableRow.size(), equalTo(actualTableRow.size()));
    assertThat(actualTableRow, equalTo(expectedTableRow));
}
 
Example 3
Source File: JdbcConverters.java    From DataflowTemplates with Apache License 2.0 4 votes vote down vote up
/** Factory method for {@link ResultSetToTableRow}. */
public static JdbcIO.RowMapper<TableRow> getResultSetToTableRow() {
  return new ResultSetToTableRow();
}
 
Example 4
Source File: DynamicJdbcIO.java    From DataflowTemplates with Apache License 2.0 4 votes vote down vote up
@Nullable
abstract JdbcIO.RowMapper<T> getRowMapper();
 
Example 5
Source File: DynamicJdbcIO.java    From DataflowTemplates with Apache License 2.0 4 votes vote down vote up
public DynamicRead<T> withRowMapper(JdbcIO.RowMapper<T> rowMapper) {
  checkArgument(rowMapper != null, ".withRowMapper(rowMapper) called with null rowMapper");
  return toBuilder().setRowMapper(rowMapper).build();
}
 
Example 6
Source File: DynamicJdbcIO.java    From DataflowTemplates with Apache License 2.0 votes vote down vote up
abstract Builder<T> setRowMapper(JdbcIO.RowMapper<T> rowMapper);