Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a06cd53

Browse files
ufleischflemch
andauthored
fix: allow restore on-demand mode database (#311) (#313)
Fix KeyError: 'ProvisionedThroughput' which occurs when trying to restore a DynamoDB which is in on-demand mode. Co-authored-by: Urs Fleisch <urs.fleisch@meteoswiss.ch>
1 parent dc12c58 commit a06cd53

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎dynamodump/dynamodump.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def prepare_gsi_for_restore(gsi, billing_mode):
822822
"Projection": gsi["Projection"],
823823
}
824824

825-
if billing_mode != PAY_PER_REQUEST_BILLING_MODE:
825+
if billing_mode != PAY_PER_REQUEST_BILLING_MODEand"ProvisionedThroughput"ingsi:
826826
result["ProvisionedThroughput"] = prepare_provisioned_throughput_for_restore(
827827
gsi["ProvisionedThroughput"]
828828
)
@@ -900,6 +900,9 @@ def do_restore(
900900
original_gsi_read_capacities = []
901901
if table_global_secondary_indexes is not None:
902902
for gsi in table_global_secondary_indexes:
903+
if "ProvisionedThroughput" not in gsi:
904+
continue
905+
903906
# keeps track of original gsi write capacity units. If provisioned capacity is 0, set to
904907
# RESTORE_WRITE_CAPACITY as fallback given that 0 is not allowed for write capacities
905908
original_gsi_write_capacity = gsi["ProvisionedThroughput"][
@@ -1065,6 +1068,9 @@ def do_restore(
10651068
if table_global_secondary_indexes is not None:
10661069
gsi_data = []
10671070
for gsi in table_global_secondary_indexes:
1071+
if "ProvisionedThroughput" not in gsi:
1072+
continue
1073+
10681074
wcu = gsi["ProvisionedThroughput"]["WriteCapacityUnits"]
10691075
rcu = gsi["ProvisionedThroughput"]["ReadCapacityUnits"]
10701076
original_gsi_write_capacity = original_gsi_write_capacities.pop(0)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /