Skip to content

Commit a895b20

Browse files
committed
version
1 parent 1d6b93d commit a895b20

File tree

4 files changed

+66
-2
lines changed

4 files changed

+66
-2
lines changed

airbyte-cdk/java/airbyte-cdk/core/src/main/java/io/airbyte/cdk/integrations/base/JavaBaseConstants.java

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.util.List;
88
import java.util.Set;
9+
import org.apache.commons.lang3.StringUtils;
910

1011
public final class JavaBaseConstants {
1112

@@ -53,4 +54,8 @@ private JavaBaseConstants() {}
5354

5455
public static final String DEFAULT_AIRBYTE_INTERNAL_NAMESPACE = "airbyte_internal";
5556

57+
public static String upperQuoted(final String column) {
58+
return StringUtils.wrap(column.toUpperCase(), "\"");
59+
}
60+
5661
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=0.24.0
1+
version=0.24.1

airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/java/io/airbyte/cdk/integrations/destination/jdbc/AbstractJdbcDestination.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ protected String getConfigSchemaKey() {
8080
return "schema";
8181
}
8282

83+
/**
84+
* If the destination should always disable type dedupe, override this method to return true. We
85+
* only type and dedupe if we create final tables.
86+
*
87+
* @return whether the destination should always disable type dedupe
88+
*/
89+
protected boolean shouldAlwaysDisableTypeDedupe() {
90+
return false;
91+
}
92+
8393
public AbstractJdbcDestination(final String driverClass,
8494
final NamingConventionTransformer namingResolver,
8595
final SqlOperations sqlOperations) {
@@ -317,6 +327,10 @@ public SerializedAirbyteMessageConsumer getSerializedMessageConsumer(final JsonN
317327
typerDeduper);
318328
}
319329

330+
private boolean isTypeDedupeDisabled(final JsonNode config) {
331+
return shouldAlwaysDisableTypeDedupe() || (config.has(DISABLE_TYPE_DEDUPE) && config.get(DISABLE_TYPE_DEDUPE).asBoolean(false));
332+
}
333+
320334
/**
321335
* Creates the appropriate TyperDeduper class for the jdbc destination and the user's configuration
322336
*
@@ -337,7 +351,7 @@ private TyperDeduper getV2TyperDeduper(final JsonNode config, final ConfiguredAi
337351
final NoopV2TableMigrator v2TableMigrator = new NoopV2TableMigrator();
338352
final DestinationHandler<DestinationState> destinationHandler =
339353
getDestinationHandler(databaseName, database, rawNamespaceOverride.orElse(DEFAULT_AIRBYTE_INTERNAL_NAMESPACE));
340-
final boolean disableTypeDedupe = config.has(DISABLE_TYPE_DEDUPE) && config.get(DISABLE_TYPE_DEDUPE).asBoolean(false);
354+
final boolean disableTypeDedupe = isTypeDedupeDisabled(config);
341355
final TyperDeduper typerDeduper;
342356
List<Migration<DestinationState>> migrations = getMigrations(database, databaseName, sqlGenerator, destinationHandler);
343357
if (disableTypeDedupe) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2024 Airbyte, Inc., all rights reserved.
3+
*/
4+
5+
package io.airbyte.cdk.integrations.destination.jdbc.typing_deduping
6+
7+
import com.fasterxml.jackson.databind.JsonNode
8+
import io.airbyte.cdk.db.jdbc.JdbcDatabase
9+
import io.airbyte.cdk.integrations.destination.jdbc.TableDefinition
10+
import io.airbyte.integrations.base.destination.typing_deduping.AirbyteType
11+
import io.airbyte.integrations.base.destination.typing_deduping.Sql
12+
import io.airbyte.integrations.base.destination.typing_deduping.StreamConfig
13+
import org.jooq.SQLDialect
14+
15+
class NoOpJdbcDestinationHandler<DestinationState>(
16+
databaseName: String,
17+
jdbcDatabase: JdbcDatabase,
18+
rawTableSchemaName: String,
19+
sqlDialect: SQLDialect
20+
) :
21+
JdbcDestinationHandler<DestinationState>(
22+
databaseName,
23+
jdbcDatabase,
24+
rawTableSchemaName,
25+
sqlDialect
26+
) {
27+
override fun execute(sql: Sql?) {
28+
throw NotImplementedError("This JDBC Destination Handler does not support typing deduping")
29+
}
30+
31+
override fun toDestinationState(json: JsonNode?): DestinationState {
32+
throw NotImplementedError("This JDBC Destination Handler does not support typing deduping")
33+
}
34+
35+
override fun existingSchemaMatchesStreamConfig(
36+
stream: StreamConfig?,
37+
existingTable: TableDefinition?
38+
): Boolean {
39+
throw NotImplementedError("This JDBC Destination Handler does not support typing deduping")
40+
}
41+
42+
override fun toJdbcTypeName(airbyteType: AirbyteType?): String {
43+
throw NotImplementedError("This JDBC Destination Handler does not support typing deduping")
44+
}
45+
}

0 commit comments

Comments
 (0)