@Experimental(value=SOURCE_SINK) public final class DynamoDBIO extends java.lang.Object
PTransform
s to read/write from/to Amazon
DynamoDB.
Example usage:
PCollection<List<Map<String, AttributeValue>>> output =
pipeline.apply(
DynamoDBIO.<List<Map<String, AttributeValue>>>read()
.withDynamoDbClientProvider(new BasicDynamoDbClientProvider(dynamoDbClientProvider, region))
.withScanRequestFn(
(SerializableFunction<Void, ScanRequest>)
input -> new ScanRequest(tableName).withTotalSegments(1))
.items());
As a client, you need to provide at least the following things:
PTransform
s to read/write from/to 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.builder()
.setMaxAttempts(5)
.setMaxDuration(Duration.standardMinutes(1))
.build())
.withDynamoDbClientProvider(new BasicDynamoDbClientProvider(dynamoDbClientProvider, 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.Modifier and Type | Class and Description |
---|---|
static class |
DynamoDBIO.Read<T>
Read data from DynamoDB and return ScanResult.
|
static class |
DynamoDBIO.RetryConfiguration
A POJO encapsulating a configuration for retry behavior when issuing requests to DynamoDB.
|
static class |
DynamoDBIO.Write<T>
Write a PCollection
|
Constructor and Description |
---|
DynamoDBIO() |
Modifier and Type | Method and Description |
---|---|
static <T> DynamoDBIO.Read<T> |
read() |
static <T> DynamoDBIO.Write<T> |
write() |
public static <T> DynamoDBIO.Read<T> read()
public static <T> DynamoDBIO.Write<T> write()