Skip to content
This repository was archived by the owner on Dec 1, 2022. It is now read-only.

Commit 2820313

Browse files
authored
Support for DynamoDB with >100 tables
1 parent 2e1b09e commit 2820313

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Provisioner.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,20 @@ export default class Provisioner extends ProvisionerConfigurableBase {
2020
async getTableNamesAsync(): Promise<string[]> {
2121

2222
// Option 1 - All tables (Default)
23+
// The output from ListTables is paginated, with each page
24+
// returning a maximum of 100 table names.
2325
let listTablesResponse = await this.db.listTablesAsync();
24-
return listTablesResponse.TableNames;
26+
var tableNames = listTablesResponse.TableNames;
27+
var lastTable = listTablesResponse.LastEvaluatedTableName;
28+
29+
while (lastTable) {
30+
var params = { ExclusiveStartTableName: lastTable };
31+
let listTablesResponse = await this.db.listTablesAsync(params);
32+
tableNames = tableNames.concat(listTablesResponse.TableNames);
33+
lastTable = listTablesResponse.LastEvaluatedTableName;
34+
}
35+
36+
return tableNames;
2537

2638
// Option 2 - Hardcoded list of tables
2739
// return ['Table1', 'Table2', 'Table3'];

0 commit comments

Comments
 (0)