JingsongLi commented on a change in pull request #11381: 
[FLINK-16294][connectors /jdbc]Support to create non-existed table in database 
automatically when writing data to JDBC connector.
URL: https://github.com/apache/flink/pull/11381#discussion_r398288580
 
 

 ##########
 File path: 
flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCUpsertTableSink.java
 ##########
 @@ -88,6 +92,15 @@ private JDBCUpsertTableSink(
                        .setFieldTypes(jdbcSqlTypes)
                        .setKeyFields(keyFields)
                        .build();
+
+               try {
+                       if (autoCreateTable) {
+                               
CreateJdbcTableUtil.createTableIfNotExists(options, schema.getFieldNames(), 
jdbcSqlTypes, keyFields);
+                       }
+               } catch (RuntimeException e) {
+                       throw new RuntimeException(String.format("Try to create 
jdbc table %s failed.", options.getTableName()), e);
 
 Review comment:
   Maybe just throw exception?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to