Skip to content

Commit

Permalink
version
Browse files Browse the repository at this point in the history
  • Loading branch information
jbfbell committed Mar 14, 2024
1 parent 1d6b93d commit a895b20
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;

public final class JavaBaseConstants {

Expand Down Expand Up @@ -53,4 +54,8 @@ private JavaBaseConstants() {}

public static final String DEFAULT_AIRBYTE_INTERNAL_NAMESPACE = "airbyte_internal";

public static String upperQuoted(final String column) {
return StringUtils.wrap(column.toUpperCase(), "\"");
}

}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.24.0
version=0.24.1
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ protected String getConfigSchemaKey() {
return "schema";
}

/**
* If the destination should always disable type dedupe, override this method to return true. We
* only type and dedupe if we create final tables.
*
* @return whether the destination should always disable type dedupe
*/
protected boolean shouldAlwaysDisableTypeDedupe() {
return false;
}

public AbstractJdbcDestination(final String driverClass,
final NamingConventionTransformer namingResolver,
final SqlOperations sqlOperations) {
Expand Down Expand Up @@ -317,6 +327,10 @@ public SerializedAirbyteMessageConsumer getSerializedMessageConsumer(final JsonN
typerDeduper);
}

private boolean isTypeDedupeDisabled(final JsonNode config) {
return shouldAlwaysDisableTypeDedupe() || (config.has(DISABLE_TYPE_DEDUPE) && config.get(DISABLE_TYPE_DEDUPE).asBoolean(false));
}

/**
* Creates the appropriate TyperDeduper class for the jdbc destination and the user's configuration
*
Expand All @@ -337,7 +351,7 @@ private TyperDeduper getV2TyperDeduper(final JsonNode config, final ConfiguredAi
final NoopV2TableMigrator v2TableMigrator = new NoopV2TableMigrator();
final DestinationHandler<DestinationState> destinationHandler =
getDestinationHandler(databaseName, database, rawNamespaceOverride.orElse(DEFAULT_AIRBYTE_INTERNAL_NAMESPACE));
final boolean disableTypeDedupe = config.has(DISABLE_TYPE_DEDUPE) && config.get(DISABLE_TYPE_DEDUPE).asBoolean(false);
final boolean disableTypeDedupe = isTypeDedupeDisabled(config);
final TyperDeduper typerDeduper;
List<Migration<DestinationState>> migrations = getMigrations(database, databaseName, sqlGenerator, destinationHandler);
if (disableTypeDedupe) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2024 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.cdk.integrations.destination.jdbc.typing_deduping

import com.fasterxml.jackson.databind.JsonNode
import io.airbyte.cdk.db.jdbc.JdbcDatabase
import io.airbyte.cdk.integrations.destination.jdbc.TableDefinition
import io.airbyte.integrations.base.destination.typing_deduping.AirbyteType
import io.airbyte.integrations.base.destination.typing_deduping.Sql
import io.airbyte.integrations.base.destination.typing_deduping.StreamConfig
import org.jooq.SQLDialect

class NoOpJdbcDestinationHandler<DestinationState>(
databaseName: String,
jdbcDatabase: JdbcDatabase,
rawTableSchemaName: String,
sqlDialect: SQLDialect
) :
JdbcDestinationHandler<DestinationState>(
databaseName,
jdbcDatabase,
rawTableSchemaName,
sqlDialect
) {
override fun execute(sql: Sql?) {
throw NotImplementedError("This JDBC Destination Handler does not support typing deduping")
}

override fun toDestinationState(json: JsonNode?): DestinationState {
throw NotImplementedError("This JDBC Destination Handler does not support typing deduping")
}

override fun existingSchemaMatchesStreamConfig(
stream: StreamConfig?,
existingTable: TableDefinition?
): Boolean {
throw NotImplementedError("This JDBC Destination Handler does not support typing deduping")
}

override fun toJdbcTypeName(airbyteType: AirbyteType?): String {
throw NotImplementedError("This JDBC Destination Handler does not support typing deduping")
}
}

0 comments on commit a895b20

Please sign in to comment.