Last active
December 29, 2018 06:08
-
-
Save sandboxws/7a0d1dacfaf5714090f182ebc12d8921 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PCollection<HashMap<String, Object>> rows = pipeline.apply( | |
| "Read Albums from PG", | |
| JdbcIO.<HashMap<String, Object>>read() | |
| .withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create(pgDataSource)) | |
| .withCoder(TableRowCoder.of()) | |
| // Map ResultSet row to a HashMap | |
| .withRowMapper(new RowMapper<HashMap<String, Object>>() { | |
| @Override | |
| public HashMap<String, Object> mapRow(ResultSet resultSet) throws Exception { | |
| return TableRowMapper.asMap(resultSet, tableName, pkName); | |
| } | |
| }) | |
| .withQuery("select * from public.\"Album\"")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment