Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source-DynamoDB : Fix failing build #22682

Merged
merged 4 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |