Skip to content

Commit

Permalink
Add escape quoting to selecting max (pk_field) query (airbytehq#30059)
Browse files Browse the repository at this point in the history
  • Loading branch information
akashkulk authored and harrytou committed Sep 1, 2023
1 parent 23fc5e7 commit ebfcab7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package io.airbyte.integrations.source.mysql;

import static io.airbyte.integrations.source.relationaldb.RelationalDbQueryUtils.getFullyQualifiedTableNameWithQuoting;
import static io.airbyte.integrations.source.relationaldb.RelationalDbQueryUtils.getIdentifierWithQuoting;

import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -85,7 +86,7 @@ public static String getMaxPkValueForStream(final JdbcDatabase database,
final String fullTableName =
getFullyQualifiedTableNameWithQuoting(namespace, name, quoteString);
final String maxPkQuery = String.format(MAX_PK_VALUE_QUERY,
pkFieldName,
getIdentifierWithQuoting(pkFieldName, quoteString),
MAX_PK_COL,
fullTableName);
LOGGER.info("Querying for max pk value: {}", maxPkQuery);
Expand Down Expand Up @@ -134,7 +135,6 @@ private static List<JsonNode> getTableEstimate(final JdbcDatabase database, fina
// Construct the table estimate query.
final String tableEstimateQuery =
String.format(TABLE_ESTIMATE_QUERY, TABLE_SIZE_BYTES_COL, AVG_ROW_LENGTH, namespace, name);
LOGGER.info("table estimate query: {}", tableEstimateQuery);
final List<JsonNode> jsonNodes = database.bufferedResultSetQuery(conn -> conn.createStatement().executeQuery(tableEstimateQuery),
resultSet -> JdbcUtils.getDefaultSourceOperations().rowToJson(resultSet));
Preconditions.checkState(jsonNodes.size() == 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

public class TestConstants {

public static final int INITIAL_CDC_WAITING_SECONDS = 5;
public static final int INITIAL_CDC_WAITING_SECONDS = 10;

}

0 comments on commit ebfcab7

Please sign in to comment.