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 . These examples are extracted from open source projects. 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 Project: DataflowTemplates   File: DynamicJdbcIO.java    License: 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
@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
/** Factory method for {@link ResultSetToTableRow}. */
public static JdbcIO.RowMapper<TableRow> getResultSetToTableRow() {
  return new ResultSetToTableRow();
}
 
Example 4
Source Project: DataflowTemplates   File: DynamicJdbcIO.java    License: Apache License 2.0 4 votes vote down vote up
@Nullable
abstract JdbcIO.RowMapper<T> getRowMapper();
 
Example 5
Source Project: DataflowTemplates   File: DynamicJdbcIO.java    License: 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
abstract Builder<T> setRowMapper(JdbcIO.RowMapper<T> rowMapper);