|
42 | 42 | import java.util.UUID;
|
43 | 43 | import java.util.stream.Collectors;
|
44 | 44 | import net.snowflake.client.jdbc.SnowflakeSQLException;
|
45 |
| -import org.apache.commons.lang3.StringUtils; |
46 | 45 | import org.apache.commons.text.StringSubstitutor;
|
47 | 46 | import org.jooq.SQLDialect;
|
48 | 47 | import org.slf4j.Logger;
|
@@ -362,30 +361,4 @@ private String toJdbcTypeName(final AirbyteProtocolType airbyteProtocolType) {
|
362 | 361 | };
|
363 | 362 | }
|
364 | 363 |
|
365 |
| - protected String getDeleteStatesSql(Map<StreamId, ? extends SnowflakeState> destinationStates) { |
366 |
| - // only doing the DELETE where there's rows to delete allows us to avoid taking a lock on the table |
367 |
| - // when there's nothing to delete |
368 |
| - // This is particularly relevant in the context of tests, where many instance of the snowflake |
369 |
| - // destination could be run in parallel |
370 |
| - String deleteStatesSql = super.getDeleteStatesSql(destinationStates); |
371 |
| - StringBuilder sql = new StringBuilder(); |
372 |
| - // sql.append("BEGIN\n"); |
373 |
| - sql.append(" IF (EXISTS (").append(deleteStatesSql.replace("delete from", "SELECT 1 FROM ")).append(")) THEN\n"); |
374 |
| - sql.append(" ").append(deleteStatesSql).append(";\n"); |
375 |
| - sql.append(" END IF\n"); |
376 |
| - // sql.append("END;\n"); |
377 |
| - return sql.toString(); |
378 |
| - } |
379 |
| - |
380 |
| - protected void executeWithinTransaction(List<String> statements) throws SQLException { |
381 |
| - StringBuilder sb = new StringBuilder(); |
382 |
| - sb.append("BEGIN\n"); |
383 |
| - sb.append(" BEGIN TRANSACTION;\n "); |
384 |
| - sb.append(StringUtils.join(statements, ";\n ")); |
385 |
| - sb.append(";\n COMMIT;\n"); |
386 |
| - sb.append("END;"); |
387 |
| - LOGGER.info("executing SQL:" + sb); |
388 |
| - getJdbcDatabase().execute(sb.toString()); |
389 |
| - } |
390 |
| - |
391 | 364 | }
|
0 commit comments