Skip to content

Commit

Permalink
postgres updates to latest cdk
Browse files Browse the repository at this point in the history
  • Loading branch information
edgao committed Apr 8, 2024
1 parent 3b5d377 commit 3777760
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
airbyteJavaConnector {
cdkVersionRequired = '0.20.4'
features = ['db-destinations', 'typing-deduping', 'datastore-postgres']
useLocalCdk = false
useLocalCdk = true
}

application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
airbyteJavaConnector {
cdkVersionRequired = '0.20.4'
features = ['db-destinations', 'datastore-postgres', 'typing-deduping']
useLocalCdk = false
useLocalCdk = true
}

application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import static io.airbyte.cdk.integrations.base.JavaBaseConstants.COLUMN_NAME_AB_META;
import static io.airbyte.cdk.integrations.base.JavaBaseConstants.COLUMN_NAME_AB_RAW_ID;
import static io.airbyte.cdk.integrations.base.JavaBaseConstants.COLUMN_NAME_DATA;
import static java.util.Collections.emptyList;
import static org.jooq.impl.DSL.array;
import static org.jooq.impl.DSL.case_;
import static org.jooq.impl.DSL.cast;
Expand Down Expand Up @@ -150,21 +149,6 @@ public Sql createTable(final StreamConfig stream, final String suffix, final boo
return Sql.concat(statements);
}

@Override
protected List<String> createIndexSql(final StreamConfig stream, final String suffix) {
if (stream.destinationSyncMode() == DestinationSyncMode.APPEND_DEDUP && !stream.primaryKey().isEmpty()) {
return List.of(
getDslContext().createIndex().on(
name(stream.id().finalNamespace(), stream.id().finalName() + suffix),
stream.primaryKey().stream()
.map(pk -> quotedName(pk.name()))
.toList())
.getSQL());
} else {
return emptyList();
}
}

@Override
protected List<Field<?>> extractRawDataFields(final LinkedHashMap<ColumnId, AirbyteType> columns, final boolean useExpensiveSaferCasting) {
return columns
Expand All @@ -173,20 +157,12 @@ protected List<Field<?>> extractRawDataFields(final LinkedHashMap<ColumnId, Airb
.map(column -> castedField(
extractColumnAsJson(column.getKey()),
column.getValue(),
column.getKey().name(),
useExpensiveSaferCasting))
.collect(Collectors.toList());
useExpensiveSaferCasting
).as(quotedName(column.getKey().name()))
).collect(Collectors.toList());
}

@Override
protected Field<?> castedField(
final Field<?> field,
final AirbyteType type,
final String alias,
final boolean useExpensiveSaferCasting) {
return castedField(field, type, useExpensiveSaferCasting).as(quotedName(alias));
}

protected Field<?> castedField(
final Field<?> field,
final AirbyteType type,
Expand Down

0 comments on commit 3777760

Please sign in to comment.