Я пытаюсь выполнить процедуру postgres, используя JDBCIO для Apache Beam.
До сих пор я пытался:
.apply(JdbcIO.<MyData>write()
.withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create(
"org.postgresql.Driver", "jdbc:postgresql://localhost:5432/postgres")
.withUsername("postgres")
.withPassword("password"))
.withStatement("do $$\n" +
"begin " +
"perform test_routine(first := ?, second := ?, age := ?) " +
"end\n" +
"$$;")
.withPreparedStatementSetter(new JdbcIO.PreparedStatementSetter<MyData>() {
public void setParameters(MyData element, PreparedStatement query)
throws SQLException {
query.setString(1,element.mfirst);
query.setString(2, element.second);
query.setInt(3, element.age);
}
})
);
К сожалению, это дает мне ошибку:
org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0
Мне удалось заставить его работать с простым оператором вставки,но в идеале хотелось бы назвать рутиной.Любая помощь будет оценена.