Skip to content

Commit

Permalink
馃悰 Source Dynamodb: fix list more than 100 tables (#31935)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
Co-authored-by: marcosmarxm <marcosmarxm@gmail.com>
  • Loading branch information
3 people committed May 1, 2024
1 parent 6f69a00 commit ccfb775
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
Expand Up @@ -5,7 +5,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 50401137-8871-4c5a-abb7-1f5fda35545a
dockerImageTag: 0.3.0
dockerImageTag: 0.3.1
dockerRepository: airbyte/source-dynamodb
documentationUrl: https://docs.airbyte.com/integrations/sources/dynamodb
githubIssueLabel: source-dynamodb
Expand Down
Expand Up @@ -22,6 +22,8 @@
import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest;
import software.amazon.awssdk.services.dynamodb.model.ListTablesRequest;
import software.amazon.awssdk.services.dynamodb.model.ListTablesResponse;
import software.amazon.awssdk.services.dynamodb.model.ScanRequest;

public class DynamodbOperations extends AbstractDatabase implements Closeable {
Expand Down Expand Up @@ -56,9 +58,24 @@ private void initMappers() {
}

public List<String> listTables() {
return dynamoDbClient.listTables()
// filter on table status?
.tableNames();
List<String> tableNames = new ArrayList<>();
ListTablesRequest listTablesRequest = ListTablesRequest.builder().build();
boolean completed = false;

while (!completed) {
ListTablesResponse listTablesResponse = dynamoDbClient.listTables(listTablesRequest);
tableNames.addAll(listTablesResponse.tableNames());

if (listTablesResponse.lastEvaluatedTableName() == null) {
completed = true;
} else {
listTablesRequest = listTablesRequest.toBuilder()
.exclusiveStartTableName(listTablesResponse.lastEvaluatedTableName())
.build();
}
}

return tableNames;
}

public List<String> primaryKey(String tableName) {
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/dynamodb.md
Expand Up @@ -75,6 +75,7 @@ the underlying role executing the container workload in AWS.

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

0 comments on commit ccfb775

Please sign in to comment.