beam-sdks-java-io-amazon-web-services
is deprecated and will be
eventually removed. Please migrate to DynamoDBIO
in module beam-sdks-java-io-amazon-web-services2
.@Experimental(value=SOURCE_SINK) @Deprecated public final class DynamoDBIO extends java.lang.Object
PTransform
s to read/write from/to Amazon
DynamoDB.
Example usage:
PCollection<T> data = ...;
data.apply(
DynamoDBIO.<WriteRequest>write()
.withWriteRequestMapperFn(
(SerializableFunction<T, KV<String, WriteRequest>>)
//Transforming your T data into KV<String, WriteRequest>
t -> KV.of(tableName, writeRequest))
.withRetryConfiguration(
DynamoDBIO.RetryConfiguration.create(5, Duration.standardMinutes(1)))
.withAwsClientsProvider(new BasicDynamoDbProvider(accessKey, secretKey, region));
As a client, you need to provide at least the following things:
DynamoDBIO.Write.withDeduplicateKeys(List)
. Based on these keys only the last
observed element is kept. Nevertheless, if no deduplication keys are provided, identical elements
are still deduplicated.
Example usage:
PCollection<List<Map<String, AttributeValue>>> output =
pipeline.apply(
DynamoDBIO.<List<Map<String, AttributeValue>>>read()
.withAwsClientsProvider(new BasicDynamoDBProvider(accessKey, secretKey, region))
.withScanRequestFn(
(SerializableFunction<Void, ScanRequest>)
input -> new ScanRequest(tableName).withTotalSegments(1))
.items());
As a client, you need to provide at least the following things:
Modifier and Type | Class and Description |
---|---|
static class |
DynamoDBIO.Read<T>
Deprecated.
Read data from DynamoDB and return ScanResult.
|
static class |
DynamoDBIO.RetryConfiguration
Deprecated.
A POJO encapsulating a configuration for retry behavior when issuing requests to DynamoDB.
|
static class |
DynamoDBIO.Write<T>
Deprecated.
Write a PCollection
|
Constructor and Description |
---|
DynamoDBIO()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static <T> DynamoDBIO.Read<T> |
read()
Deprecated.
|
static <T> DynamoDBIO.Write<T> |
write()
Deprecated.
|
public static <T> DynamoDBIO.Read<T> read()
public static <T> DynamoDBIO.Write<T> write()