Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ def create_table(self, table_name):
{"AttributeName": "year", "AttributeType": "N"},
{"AttributeName": "title", "AttributeType": "S"},
],
ProvisionedThroughput={
"ReadCapacityUnits": 10,
"WriteCapacityUnits": 10,
},
BillingMode='PAY_PER_REQUEST',
)
self.table.wait_until_exists()
except ClientError as err:
Expand Down
18 changes: 9 additions & 9 deletions python/example_code/dynamodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ Code excerpts that show you how to call individual service functions.

- [BatchExecuteStatement](partiql/scenario_partiql_batch.py#L44)
- [BatchGetItem](batching/dynamo_batching.py#L64)
- [BatchWriteItem](GettingStarted/scenario_getting_started_movies.py#L164)
- [BatchWriteItem](GettingStarted/scenario_getting_started_movies.py#L161)
- [CreateTable](GettingStarted/scenario_getting_started_movies.py#L100)
- [DeleteItem](GettingStarted/scenario_getting_started_movies.py#L342)
- [DeleteTable](GettingStarted/scenario_getting_started_movies.py#L363)
- [DeleteItem](GettingStarted/scenario_getting_started_movies.py#L339)
- [DeleteTable](GettingStarted/scenario_getting_started_movies.py#L360)
- [DescribeTable](GettingStarted/scenario_getting_started_movies.py#L70)
- [ExecuteStatement](partiql/scenario_partiql_single.py#L43)
- [GetItem](GettingStarted/scenario_getting_started_movies.py#L223)
- [ListTables](GettingStarted/scenario_getting_started_movies.py#L140)
- [PutItem](GettingStarted/scenario_getting_started_movies.py#L193)
- [Query](GettingStarted/scenario_getting_started_movies.py#L280)
- [Scan](GettingStarted/scenario_getting_started_movies.py#L303)
- [UpdateItem](GettingStarted/scenario_getting_started_movies.py#L248)
- [GetItem](GettingStarted/scenario_getting_started_movies.py#L220)
- [ListTables](GettingStarted/scenario_getting_started_movies.py#L137)
- [PutItem](GettingStarted/scenario_getting_started_movies.py#L190)
- [Query](GettingStarted/scenario_getting_started_movies.py#L277)
- [Scan](GettingStarted/scenario_getting_started_movies.py#L300)
- [UpdateItem](GettingStarted/scenario_getting_started_movies.py#L245)

### Scenarios

Expand Down
2 changes: 1 addition & 1 deletion python/example_code/dynamodb/TryDax/01-create-table.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def create_dax_table(dyn_resource=None):
{"AttributeName": "partition_key", "AttributeType": "N"},
{"AttributeName": "sort_key", "AttributeType": "N"},
],
"ProvisionedThroughput": {"ReadCapacityUnits": 10, "WriteCapacityUnits": 10},
"BillingMode": "PAY_PER_REQUEST",
}
table = dyn_resource.create_table(**params)
print(f"Creating {table_name}...")
Expand Down
11 changes: 2 additions & 9 deletions python/example_code/dynamodb/batching/dynamo_batching.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create_table(table_name, schema):
{"AttributeName": item["name"], "AttributeType": item["type"]}
for item in schema
],
ProvisionedThroughput={"ReadCapacityUnits": 10, "WriteCapacityUnits": 10},
BillingMode='PAY_PER_REQUEST',
)
table.wait_until_exists()
logger.info("Created table %s.", table.name)
Expand Down Expand Up @@ -194,14 +194,7 @@ def archive_movies(movie_table, movie_data):
TableName=f"{movie_table.name}-archive",
KeySchema=movie_table.key_schema,
AttributeDefinitions=movie_table.attribute_definitions,
ProvisionedThroughput={
"ReadCapacityUnits": movie_table.provisioned_throughput[
"ReadCapacityUnits"
],
"WriteCapacityUnits": movie_table.provisioned_throughput[
"WriteCapacityUnits"
],
},
BillingMode='PAY_PER_REQUEST',
)
logger.info("Table %s created, wait until exists.", archive_table.name)
archive_table.wait_until_exists()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_create_table(

with stub_runner(error_code, stop_on_method) as runner:
runner.add(
dyn_stubber.stub_create_table, table_name, schema, {"read": 10, "write": 10}
dyn_stubber.stub_create_table, table_name, schema
)
runner.add(dyn_stubber.stub_describe_table, table_name)

Expand Down
5 changes: 1 addition & 4 deletions python/example_code/dynamodb/partiql/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ def create_table(self, table_name):
{"AttributeName": "year", "AttributeType": "N"},
{"AttributeName": "title", "AttributeType": "S"},
],
ProvisionedThroughput={
"ReadCapacityUnits": 10,
"WriteCapacityUnits": 10,
},
BillingMode='PAY_PER_REQUEST',
)
self.table.wait_until_exists()
except ClientError as err:
Expand Down
7 changes: 2 additions & 5 deletions python/test_tools/dynamodb_stubber.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,9 @@ def _build_out_item(self, in_item):
out_item[key] = {value_type: out_val}
return out_item

def stub_create_table(self, table_name, schema, throughput, error_code=None):
def stub_create_table(self, table_name, schema, error_code=None):
table_input = {
"ProvisionedThroughput": {
"ReadCapacityUnits": throughput["read"],
"WriteCapacityUnits": throughput["write"],
}
"BillingMode": "PAY_PER_REQUEST",
}
self._add_table_schema(table_input, table_name, schema)

Expand Down
Loading