Skip to content

Commit

Permalink
Source-DynamoDB : Fix failing build (#22682)
Browse files Browse the repository at this point in the history
* Fix failing DynamoDB source build

* Bump version
  • Loading branch information
akashkulk committed Feb 10, 2023
1 parent 6058e42 commit 762a8cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-dynamodb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ENV APPLICATION source-dynamodb
COPY --from=build /airbyte /airbyte

# Airbyte's build system uses these labels to know what to name and tag the docker images produced by this Dockerfile.
LABEL io.airbyte.version=0.1.0
LABEL io.airbyte.version=0.1.1
LABEL io.airbyte.name=airbyte/source-dynamodb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ private DynamodbUtils() {

}

public static DynamoDbClient createDynamoDbClient(DynamodbConfig dynamodbConfig) {
var dynamoDbClientBuilder = DynamoDbClient.builder();
public static DynamoDbClient createDynamoDbClient(final DynamodbConfig dynamodbConfig) {
final var dynamoDbClientBuilder = DynamoDbClient.builder();

// configure access credentials
dynamoDbClientBuilder.credentialsProvider(StaticCredentialsProvider.create(
Expand All @@ -44,7 +44,7 @@ public static DynamoDbClient createDynamoDbClient(DynamodbConfig dynamodbConfig)
return dynamoDbClientBuilder.build();
}

public static AirbyteMessage mapAirbyteMessage(String stream, JsonNode data) {
public static AirbyteMessage mapAirbyteMessage(final String stream, final JsonNode data) {
return new AirbyteMessage()
.withType(AirbyteMessage.Type.RECORD)
.withRecord(new AirbyteRecordMessage()
Expand All @@ -53,12 +53,13 @@ public static AirbyteMessage mapAirbyteMessage(String stream, JsonNode data) {
.withData(data));
}

public static StreamState deserializeStreamState(JsonNode state, boolean useStreamCapableState) {
Optional<StateWrapper> typedState =
public static StreamState deserializeStreamState(final JsonNode state, final boolean useStreamCapableState) {
final Optional<StateWrapper> typedState =
StateMessageHelper.getTypedState(state, useStreamCapableState);
return typedState.map(stateWrapper -> switch (stateWrapper.getStateType()) {
case STREAM:
yield new StreamState(AirbyteStateMessage.AirbyteStateType.STREAM, stateWrapper.getStateMessages());
yield new StreamState(AirbyteStateMessage.AirbyteStateType.STREAM,
stateWrapper.getStateMessages().stream().map(DynamodbUtils::convertStateMessage).toList());
case LEGACY:
yield new StreamState(AirbyteStateMessage.AirbyteStateType.LEGACY, List.of(
new AirbyteStateMessage().withType(AirbyteStateMessage.AirbyteStateType.LEGACY)
Expand All @@ -79,6 +80,10 @@ yield new StreamState(AirbyteStateMessage.AirbyteStateType.LEGACY, List.of(
});
}

private static AirbyteStateMessage convertStateMessage(final io.airbyte.protocol.models.AirbyteStateMessage state) {
return Jsons.object(Jsons.jsonNode(state), AirbyteStateMessage.class);
}

record StreamState(

AirbyteStateMessage.AirbyteStateType airbyteStateType,
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/dynamodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ This guide describes in details how you can configure the connector to connect w

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:-------------|:----------------|
| 0.1.1 | 02-09-2023 | https://github.com/airbytehq/airbyte/pull/22682 | Build fixes |
| 0.1.0 | 11-14-2022 | https://github.com/airbytehq/airbyte/pull/18750 | Initial version |

0 comments on commit 762a8cd

Please sign in to comment.