j1cs commented on issue #26003:
URL: https://github.com/apache/beam/issues/26003#issuecomment-1509352085
works fin with row:
```javascript
public void run() {
AppOptions options = PipelineOptionsFactory
.fromArgs("--runner=DirectRunner")
.as(AppOptions.class);
Pipeline p = Pipeline.create(options);
p.apply("Selecting", JdbcIO.readRows()
.withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create(
"org.postgresql.Driver",
"jdbc:postgresql://localhost:5432/main")
.withUsername("myuser")
.withPassword("mypassword"))
.withQuery("select first_name, last_name from person
where first_name = 'john'")
.withOutputParallelization(false)
)
.apply("next step", MapElements.via(new RowToStringFunction()));
p.run();
}
@Slf4j
static class RowToStringFunction extends SimpleFunction<Row, Integer> {
@Override
public Integer apply(Row input) {
log.info("Row value: {}", input.getValue(1).toString());
return 1;
}
}
```
```
18:14:47.650 [main] INFO i.m.context.env.DefaultEnvironment - Established
active environments: [cli]
18:14:50.355 [direct-runner-worker] INFO org.apache.beam.sdk.io.jdbc.JdbcIO
- Autocommit has been disabled
18:14:50.513 [direct-runner-worker] INFO m.j.AppCommand$RowToStringFunction
- Row value: doe
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]