robertwb commented on code in PR #28971:
URL: https://github.com/apache/beam/pull/28971#discussion_r1370869412


##########
sdks/python/apache_beam/yaml/standard_io.yaml:
##########
@@ -112,3 +112,38 @@
     'WriteToJson': 'beam:schematransform:org.apache.beam:json_write:v1'
   config:
     gradle_target: 'sdks:java:extensions:schemaio-expansion-service:shadowJar'
+
+- type: renaming
+  transforms:
+    'ReadFromJdbc': 'ReadFromJdbc'
+    'WriteToJdbc': 'WriteToJdbc'
+  config:
+    mappings:
+      'ReadFromJdbc':
+        driver_class_name: 'driverClassName'
+        jdbc_url: 'jdbcUrl'
+        username: 'username'
+        password: 'password'
+        table_name: 'location'
+        read_query: 'readQuery'
+        num_rows: 'fetchSize'
+        driver_jars: 'driverJars'
+        connection_properties: 'connectionProperties'
+        connection_init_sql: 'connectionInitSql'
+      'WriteToJdbc':
+        driver_class_name: 'driverClassName'
+        jdbc_url: 'jdbcUrl'
+        username: 'username'
+        password: 'password'
+        table_name: 'location'
+        write_statement: 'writeStatement'

Review Comment:
   Actually, looking into this a bit more, we're constructing the default query 
right here: 
https://github.com/apache/beam/blob/e78a01a58f7b1e5894872217b2474fc84dea9956/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcWriteSchemaTransformProvider.java#L104
   
   Can't we use the names of the schema to construct a query
   
   `INSERT INTO {table} (field1, field2, field3, ...) VALUES ...`
   
   Yes, this would mean that names in your schema would have to agree with the 
names of your table, but this seems to be very much the right (and safe) thing 
to do. 



-- 
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]

Reply via email to