apache / apache/beam

WriteToJdbc does not respect 'statement' parameter in python

Open
#21,091 0 comments 0 reactions 0 assignees View on GitHub
bug io java jdbc P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

I need to insert geometry into my postgresql database. My pipeline stage is a follows;
```

// code placeholder
| 'Write jdbc' >> WriteToJdbc( jdbc_url='jdbc:postgresql://localhost:5432/postgre',
driver_class_name='org.postgresql.Driver', table_name='test', username='postgres',
password='postgres',
statement="""INSERT INTO test
VALUES(?, ?, ?, ST_GeomFromText(?), ?, ?, ?, ?,
?, ?)"""

```

I expect this code to write data to database and cast my text into geometry type while inserting. But it does not work.
 

Imported from Jira [BEAM-12693](https://issues.apache.org/jira/browse/BEAM-12693). Original Jira may contain additional context.
Reported by: egeucak.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Python WriteToJdbc path and how it handles the supplied statement parameter, using the PostgreSQL JDBC example in the issue as the reproduction. Verify the behavior with the shown ST_GeomFromText insert and confirm that the statement is honored when writing to PostgreSQL.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql, python
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.