Skip to content

Commit ccfb775

Browse files
🐛 Source Dynamodb: fix list more than 100 tables (#31935)
Co-authored-by: Marcos Marx <[email protected]> Co-authored-by: marcosmarxm <[email protected]>
1 parent 6f69a00 commit ccfb775

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

airbyte-integrations/connectors/source-dynamodb/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ data:
55
connectorSubtype: api
66
connectorType: source
77
definitionId: 50401137-8871-4c5a-abb7-1f5fda35545a
8-
dockerImageTag: 0.3.0
8+
dockerImageTag: 0.3.1
99
dockerRepository: airbyte/source-dynamodb
1010
documentationUrl: https://docs.airbyte.com/integrations/sources/dynamodb
1111
githubIssueLabel: source-dynamodb

airbyte-integrations/connectors/source-dynamodb/src/main/java/io/airbyte/integrations/source/dynamodb/DynamodbOperations.java

+20-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition;
2323
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
2424
import software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest;
25+
import software.amazon.awssdk.services.dynamodb.model.ListTablesRequest;
26+
import software.amazon.awssdk.services.dynamodb.model.ListTablesResponse;
2527
import software.amazon.awssdk.services.dynamodb.model.ScanRequest;
2628

2729
public class DynamodbOperations extends AbstractDatabase implements Closeable {
@@ -56,9 +58,24 @@ private void initMappers() {
5658
}
5759

5860
public List<String> listTables() {
59-
return dynamoDbClient.listTables()
60-
// filter on table status?
61-
.tableNames();
61+
List<String> tableNames = new ArrayList<>();
62+
ListTablesRequest listTablesRequest = ListTablesRequest.builder().build();
63+
boolean completed = false;
64+
65+
while (!completed) {
66+
ListTablesResponse listTablesResponse = dynamoDbClient.listTables(listTablesRequest);
67+
tableNames.addAll(listTablesResponse.tableNames());
68+
69+
if (listTablesResponse.lastEvaluatedTableName() == null) {
70+
completed = true;
71+
} else {
72+
listTablesRequest = listTablesRequest.toBuilder()
73+
.exclusiveStartTableName(listTablesResponse.lastEvaluatedTableName())
74+
.build();
75+
}
76+
}
77+
78+
return tableNames;
6279
}
6380

6481
public List<String> primaryKey(String tableName) {

docs/integrations/sources/dynamodb.md

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ the underlying role executing the container workload in AWS.
7575

7676
| Version | Date | Pull Request | Subject |
7777
|:--------| :--------- | :-------------------------------------------------------- |:-----------------------------------------------------------------------|
78+
| 0.3.1 | 2024-05-01 | [31935](https://github.com/airbytehq/airbyte/pull/31935) | Fix list more than 100 tables |
7879
| 0.3.0 | 2024-04-24 | [37530](https://github.com/airbytehq/airbyte/pull/37530) | Allow role based access |
7980
| 0.2.3 | 2024-02-13 | [35232](https://github.com/airbytehq/airbyte/pull/35232) | Adopt CDK 0.20.4 |
8081
| 0.2.2 | 2024-01-24 | [34453](https://github.com/airbytehq/airbyte/pull/34453) | bump CDK version |

0 commit comments

Comments
 (0)