Skip to content

Commit

Permalink
use generate_sink_sql=true for db2 upsert
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatsai committed Oct 20, 2024
1 parent fcc0e6b commit f8c2baa
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,15 @@ public Config mergeDatasourceConfig(
connectorConfig =
connectorConfig.withValue(QUERY_KEY, ConfigValueFactory.fromAnyRef(sql));
} else if (pluginType.equals(PluginType.SINK)) {

List<String> tableFields = selectTableFields.getTableFields();

String sql = generateDb2(tableFields, databaseName, tableName);

connectorConfig =
connectorConfig.withValue(QUERY_KEY, ConfigValueFactory.fromAnyRef(sql));
if (selectTableFields.isAll()) {
// Convert schema to SQL if all fields are present
// else use default generate_sink_sql=true
List<String> tableFields = selectTableFields.getTableFields();
String sql = generateDb2(tableFields, databaseName, tableName);
connectorConfig =
connectorConfig.withValue(
QUERY_KEY, ConfigValueFactory.fromAnyRef(sql));
}
} else {
throw new UnsupportedOperationException("Unsupported plugin type: " + pluginType);
}
Expand Down

0 comments on commit f8c2baa

Please sign in to comment.