Skip to content

Dynamodb

async_boto.clients.dynamodb

logger module-attribute

logger = getLogger(__name__)

T module-attribute

T = TypeVar('T', bound=BaseModel)

AsyncDynamoDBClient

AsyncDynamoDBClient(aws_session, endpoint_url=None)

Bases: BaseClient

Source code in async_boto/clients/dynamodb.py
225
226
227
228
229
230
231
232
def __init__(
    self, aws_session: boto3.Session | AsyncAWSSession, endpoint_url: str = None
):
    super().__init__(aws_session=aws_session, service_name="dynamodb")
    self._url = (
        endpoint_url
        or f"https://dynamodb.{self._aws_session.region_name}.amazonaws.com"
    )

describe_endpoints async

describe_endpoints()

Returns the regional endpoint information. For more information see API Docs

RETURNS DESCRIPTION
DescribeEndpointsResponse

The response object containing the results of the operation.

RAISES DESCRIPTION
ClientError

if the request fails.

Examples:

>>> from async_boto.core.session import AsyncAWSSession
>>> from async_boto.clients.dynamodb import (
...     AsyncDynamoDBClient,
...     DescribeEndpointsResponse,
... )
>>> dynamodb_client = AsyncDynamoDBClient()
>>> response = await dynamodb_client.describe_endpoints()
>>> assert isinstance(response, DescribeEndpointsResponse)
response.Endpoints
[{"Adress" : "endpoint1", "CachePeriodInMinutes": 5}]
Source code in async_boto/clients/dynamodb.py
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
async def describe_endpoints(self) -> DescribeEndpointsResponse:
    """
    Returns the regional endpoint information.
    For more information see
    [API Docs](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeEndpoints.html)

    Returns
    -------
    DescribeEndpointsResponse
        The response object containing the results of the operation.

    Raises
    -------
    async_boto.core.exceptions.ClientError
        if the request fails.

    Examples
    --------
    >>> from async_boto.core.session import AsyncAWSSession
    >>> from async_boto.clients.dynamodb import (
    ...     AsyncDynamoDBClient,
    ...     DescribeEndpointsResponse,
    ... )
    >>> dynamodb_client = AsyncDynamoDBClient()
    >>> response = await dynamodb_client.describe_endpoints()
    >>> assert isinstance(response, DescribeEndpointsResponse)
    response.Endpoints
    [{"Adress" : "endpoint1", "CachePeriodInMinutes": 5}]
    """  # noqa: E501
    return await self._make_request(
        "DynamoDB_20120810.DescribeEndpoints",
        None,
        DescribeEndpointsResponse,
    )

batch_write_items async

batch_write_items(request)

The BatchWriteItem operation puts or deletes multiple items in one or more tables. A single call to BatchWriteItem can transmit up to 16MB of data over the network, consisting of up to 25 item put or delete operations. While individual items can be up to 400 KB once stored, it's important to note that an item's representation might be greater than 400KB while being sent in DynamoDB's JSON format for the API call. For more information, see AWS API Docs

PARAMETER DESCRIPTION
request

The request object containing the parameters for the operation.

TYPE: BatchWriteItemRequest

RETURNS DESCRIPTION
BatchWriteItemsResponse

The response object containing the results of the operation.

RAISES DESCRIPTION
ClientError

if the request fails.

Examples:

>>> from async_boto.clients.dynamodb import (
...     BatchWriteItemRequest,
...     BatchWriteItemsResponse,
... )
>>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
>>> request = BatchWriteItemRequest(
...     RequestItems={
...         test_table: [
...             {
...                 "PutRequest": {
...                     "Item": {"hash": {"S": "hash1"}, "sort": {"S": "sort1"}}
...                 }
...             }
...         ]
...     }
... )
>>> dynamodb_client = AsyncDynamoDBClient()
>>> response = await dynamodb_client.batch_write_items(request=request)
>>> assert isinstance(response, BatchWriteItemsResponse)
>>> assert response.UnprocessedItems == {}
Source code in async_boto/clients/dynamodb.py
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
async def batch_write_items(
    self, request: BatchWriteItemRequest
) -> BatchWriteItemsResponse:
    """
    The BatchWriteItem operation puts or deletes multiple items in one or more
    tables. A single call to BatchWriteItem can transmit up to 16MB of data over
    the network, consisting of up to 25 item put or delete operations.
    While individual items can be up to 400 KB once stored, it's important to note
    that an item's representation might be greater than 400KB while being sent in
    DynamoDB's JSON format for the API call.
    For more information, see
    [AWS API Docs](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html)

    Parameters
    ----------
    request : BatchWriteItemRequest
        The request object containing the parameters for the operation.

    Returns
    -------
    BatchWriteItemsResponse
        The response object containing the results of the operation.

    Raises
    -------
    async_boto.core.exceptions.ClientError
        if the request fails.

    Examples
    --------
    >>> from async_boto.clients.dynamodb import (
    ...     BatchWriteItemRequest,
    ...     BatchWriteItemsResponse,
    ... )
    >>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
    >>> request = BatchWriteItemRequest(
    ...     RequestItems={
    ...         test_table: [
    ...             {
    ...                 "PutRequest": {
    ...                     "Item": {"hash": {"S": "hash1"}, "sort": {"S": "sort1"}}
    ...                 }
    ...             }
    ...         ]
    ...     }
    ... )
    >>> dynamodb_client = AsyncDynamoDBClient()
    >>> response = await dynamodb_client.batch_write_items(request=request)
    >>> assert isinstance(response, BatchWriteItemsResponse)
    >>> assert response.UnprocessedItems == {}
    """  # noqa: E501
    return await self._make_request(
        "DynamoDB_20120810.BatchWriteItem", request, BatchWriteItemsResponse
    )

put_item async

put_item(request)

Creates a new item, or replaces an old item with a new item. If an item that has the same primary key as the new item already exists in the specified table, the new item completely replaces the existing item. You can perform a conditional put operation (add a new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values. You can return the item's attribute values in the same operation, using the ReturnValues parameter. When you add an item, the primary key attributes are the only required attributes. Empty String and Binary attribute values are allowed. Attribute values of type String and Binary must have a length greater than zero if the attribute is used as a key attribute for a table or index. Set type attributes cannot be empty. Invalid Requests with empty values will be rejected with a ValidationException exception. For more information, see AWS API Docs

PARAMETER DESCRIPTION
request

The request object containing the parameters for the operation.

TYPE: PutItemRequest

RETURNS DESCRIPTION
PutItemResponse

The response object containing the results of the operation.

RAISES DESCRIPTION
ClientError

if the request fails.

Examples:

>>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
>>> dynamodb_client = AsyncDynamoDBClient()
>>> request = PutItemRequest.from_python_dict(
...     data={"hash": "hash2", "sort": "sort2"},
...     TableName=test_table,
...     ReturnConsumedCapacity="TOTAL",
... )
>>> response = await dynamodb_client.put_item(request=request)
>>> assert isinstance(response, PutItemResponse)
>>> assert response.ConsumedCapacity.CapacityUnits == 1.0
>>> assert response.ConsumedCapacity.TableName == test_table
Source code in async_boto/clients/dynamodb.py
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
async def put_item(self, request: PutItemRequest) -> PutItemResponse:
    """
    Creates a new item, or replaces an old item with a new item. If an item that
    has the same primary key as the new item already exists in the specified table,
    the new item completely replaces the existing item.
    You can perform a conditional put operation
    (add a new item if one with the specified primary key doesn't exist), or replace
     an existing item if it has certain attribute values. You can return the item's
     attribute values in the same operation, using the ReturnValues parameter.
    When you add an item, the primary key attributes are the only required attributes.
    Empty String and Binary attribute values are allowed. Attribute values of type
    String and Binary must have a length greater than zero if the attribute is used
    as a key attribute for a table or index. Set type attributes cannot be empty.
    Invalid Requests with empty values will be rejected with a ValidationException exception.
    For more information, see
    [AWS API Docs](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html)

    Parameters
    ----------
    request : PutItemRequest
        The request object containing the parameters for the operation.

    Returns
    -------
    PutItemResponse
        The response object containing the results of the operation.

    Raises
    ------
    async_boto.core.exceptions.ClientError
        if the request fails.

    Examples
    --------
    >>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
    >>> dynamodb_client = AsyncDynamoDBClient()
    >>> request = PutItemRequest.from_python_dict(
    ...     data={"hash": "hash2", "sort": "sort2"},
    ...     TableName=test_table,
    ...     ReturnConsumedCapacity="TOTAL",
    ... )

    >>> response = await dynamodb_client.put_item(request=request)
    >>> assert isinstance(response, PutItemResponse)
    >>> assert response.ConsumedCapacity.CapacityUnits == 1.0
    >>> assert response.ConsumedCapacity.TableName == test_table
    """  # noqa: E501
    return await self._make_request(
        "DynamoDB_20120810.PutItem", request, PutItemResponse
    )

scan async

scan(request)

The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index. To have DynamoDB return fewer items, you can provide a FilterExpression operation. If the total size of scanned items exceeds the maximum dataset size limit of 1 MB, the scan completes and results are returned to the user. The LastEvaluatedKey value is also returned and the requestor can use the LastEvaluatedKey to continue the scan in a subsequent operation. Each scan response also includes number of items that were scanned (ScannedCount) as part of the request. If using a FilterExpression, a scan result can result in no items meeting the criteria and the Count will result in zero. If you did not use a FilterExpression in the scan request, then Count is the same as ScannedCount. for more information, see AWS API Docs

PARAMETER DESCRIPTION
request

The request object containing the parameters for the operation.

TYPE: ScanRequest

RETURNS DESCRIPTION
ScanResponse

The response object containing the results of the operation.

RAISES DESCRIPTION
ClientError

if the request fails.

Examples:

>>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
>>> from async_boto.clients.dynamodb import ScanRequest, ScanResponse
>>> request = ScanRequest(TableName=test_table)
>>> response = await dynamodb_client.scan(request=request)
>>> assert isinstance(response, ScanResponse)
>>> items = [item.to_python_dict() for item in response.Items]
>>> assert items == [{"hash": "hash2", "sort": "sort2"}]
Source code in async_boto/clients/dynamodb.py
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
@register_paginator(
    pagination_query_key="ExclusiveStartKey",
    pagination_response_key="LastEvaluatedKey",
)
async def scan(self, request: ScanRequest) -> ScanResponse:
    """
    The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index.
    To have DynamoDB return fewer items, you can provide a FilterExpression operation.
    If the total size of scanned items exceeds the maximum dataset size limit of 1 MB,
    the scan completes and results are returned to the user.
    The LastEvaluatedKey value is also returned and the requestor can use the LastEvaluatedKey to
    continue the scan in a subsequent operation. Each scan response also includes number of items that
    were scanned (ScannedCount) as part of the request.
    If using a FilterExpression, a scan result can result in no items meeting the criteria and the
    Count will result in zero. If you did not use a FilterExpression in the scan request,
    then Count is the same as ScannedCount.
    for more information, see [AWS API Docs](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html)

    Parameters
    ----------
    request : ScanRequest
        The request object containing the parameters for the operation.

    Returns
    -------
    ScanResponse
        The response object containing the results of the operation.

    Raises
    ------
    async_boto.core.exceptions.ClientError
        if the request fails.

    Examples
    --------
    >>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
    >>> from async_boto.clients.dynamodb import ScanRequest, ScanResponse
    >>> request = ScanRequest(TableName=test_table)
    >>> response = await dynamodb_client.scan(request=request)
    >>> assert isinstance(response, ScanResponse)
    >>> items = [item.to_python_dict() for item in response.Items]
    >>> assert items == [{"hash": "hash2", "sort": "sort2"}]
    """  # noqa: E501
    return await self._make_request("DynamoDB_20120810.Scan", request, ScanResponse)

query async

query(request)

You must provide the name of the partition key attribute and a single value for that attribute. Query returns all items with that partition key value. Optionally, you can provide a sort key attribute and use a comparison operator to refine the search results. Use the KeyConditionExpression parameter to provide a specific value for the partition key. The Query operation will return all of the items from the table or index with that partition key value. You can optionally narrow the scope of the Query operation by specifying a sort key value and a comparison operator in KeyConditionExpression. To further refine the Query results, you can optionally provide a FilterExpression. A FilterExpression determines which items within the results should be returned to you. All of the other results are discarded. A Query operation always returns a result set. If no matching items are found, the result set will be empty. Queries that do not return results consume the minimum number of read capacity units for that type of read operation.

For more information, see AWS API Docs

PARAMETER DESCRIPTION
request

The request object containing the parameters for the operation.

TYPE: QueryRequest

RETURNS DESCRIPTION
QueryResponse

The response object containing the results of the operation.

RAISES DESCRIPTION
ClientError

if the request fails.

Examples:

>>> from tests.async_boto.clients.dynamodb.conftest import dynamodb_client
>>> from async_boto.clients.dynamodb import QueryRequest, QueryResponse
>>> request = QueryRequest(
...     TableName=test_table,
...     ExpressionAttributeValues={
...         ":v1": {
...             "S": "hash2",
...         },
...     },
...     KeyConditionExpression="#h=:v1",
...     ExpressionAttributeNames={
...         "#h": "hash",
...     },
... )
>>> dynamodb_client = AsyncDynamoDBClient()
>>> response = await dynamodb_client.query(request=request)
>>> assert isinstance(response, QueryResponse)
>>> items = [item.to_python_dict() for item in response.Items]
>>> assert items == [{"hash": "hash2", "sort": "sort2"}]
Source code in async_boto/clients/dynamodb.py
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
@register_paginator(
    pagination_query_key="ExclusiveStartKey",
    pagination_response_key="LastEvaluatedKey",
)
async def query(self, request: QueryRequest) -> QueryResponse:
    """
    You must provide the name of the partition key attribute and a single value for that attribute.
    Query returns all items with that partition key value.
    Optionally, you can provide a sort key attribute and use a comparison operator to refine the search results.
    Use the KeyConditionExpression parameter to provide a specific value for the partition key.
    The Query operation will return all of the items from the table or index with that partition key value.
    You can optionally narrow the scope of the Query operation by specifying a sort key value and a comparison operator in KeyConditionExpression.
    To further refine the Query results, you can optionally provide a FilterExpression.
    A FilterExpression determines which items within the results should be returned to you.
    All of the other results are discarded.
    A Query operation always returns a result set.
    If no matching items are found, the result set will be empty.
    Queries that do not return results consume the minimum number of read capacity units for that type of read operation.

    For more information, see [AWS API Docs](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html)

    Parameters
    ----------
    request : QueryRequest
        The request object containing the parameters for the operation.

    Returns
    -------
    QueryResponse
        The response object containing the results of the operation.

    Raises
    ------
    async_boto.core.exceptions.ClientError
        if the request fails.

    Examples
    --------
    >>> from tests.async_boto.clients.dynamodb.conftest import dynamodb_client
    >>> from async_boto.clients.dynamodb import QueryRequest, QueryResponse
    >>> request = QueryRequest(
    ...     TableName=test_table,
    ...     ExpressionAttributeValues={
    ...         ":v1": {
    ...             "S": "hash2",
    ...         },
    ...     },
    ...     KeyConditionExpression="#h=:v1",
    ...     ExpressionAttributeNames={
    ...         "#h": "hash",
    ...     },
    ... )
    >>> dynamodb_client = AsyncDynamoDBClient()
    >>> response = await dynamodb_client.query(request=request)
    >>> assert isinstance(response, QueryResponse)
    >>> items = [item.to_python_dict() for item in response.Items]
    >>> assert items == [{"hash": "hash2", "sort": "sort2"}]
    """  # noqa: E501
    return await self._make_request(
        "DynamoDB_20120810.Query", request, QueryResponse
    )

describe_table async

describe_table(request)

Returns information about the table, including the current status of the table, when it was created, the primary key schema, and any indexes on the table. for more information, see AWS API Docs

PARAMETER DESCRIPTION
request

The request object containing the parameters for the operation.

TYPE: DescribeTableRequest

RETURNS DESCRIPTION
DescribeTableResponse

The response object containing the results of the operation.

RAISES DESCRIPTION
ClientError

if the request fails.

Examples:

>>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
>>> from async_boto.clients.dynamodb import (
...     DescribeTableRequest,
...     DescribeTableResponse,
... )
>>> request = DescribeTableRequest(
...     TableName=test_table,
... )
>>> response = await dynamodb_client.query(request=request)
>>> assert isinstance(response, DescribeTableResponse)
>>> assert response.Table.TableName == test_table
Source code in async_boto/clients/dynamodb.py
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
async def describe_table(
    self, request: DescribeTableRequest
) -> DescribeTableResponse:
    """
    Returns information about the table,
    including the current status of the table, when it was created,
    the primary key schema, and any indexes on the table.
    for more information, see [AWS API Docs](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html)

    Parameters
    ----------
    request : DescribeTableRequest
        The request object containing the parameters for the operation.

    Returns
    -------
    DescribeTableResponse
        The response object containing the results of the operation.

    Raises
    ------
    async_boto.core.exceptions.ClientError
        if the request fails.

    Examples
    --------
    >>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
    >>> from async_boto.clients.dynamodb import (
    ...     DescribeTableRequest,
    ...     DescribeTableResponse,
    ... )
    >>> request = DescribeTableRequest(
    ...     TableName=test_table,
    ... )
    >>> response = await dynamodb_client.query(request=request)

    >>> assert isinstance(response, DescribeTableResponse)
    >>> assert response.Table.TableName == test_table
    """  # noqa: E501
    return await self._make_request(
        "DynamoDB_20120810.DescribeTable", request, DescribeTableResponse
    )

list_tables async

list_tables(request)

Returns an array of table names associated with the current account and endpoint. The output from ListTables is paginated, with each page returning a maximum of 100 table names. for more information, see AWS API Docs

PARAMETER DESCRIPTION
request

The request object containing the parameters for the operation.

TYPE: ListTablesRequest

RETURNS DESCRIPTION
ListTablesResponse

The response object containing the results of the operation.

RAISES DESCRIPTION
ClientError

if the request fails.

Examples:

>>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
>>> from async_boto.clients.dynamodb import (
...     ListTablesRequest,
...     ListTablesResponse,
... )
>>> request = ListTablesRequest()
>>> response = await dynamodb_client.list_tables(request=request)
>>> assert isinstance(response, ListTablesResponse)
>>> assert test_table in response.TableNames
Source code in async_boto/clients/dynamodb.py
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
@register_paginator(
    pagination_query_key="ExclusiveStartTableName",
    pagination_response_key="LastEvaluatedTableName",
)
async def list_tables(self, request: ListTablesRequest) -> ListTablesResponse:
    """
    Returns an array of table names associated with the current account and endpoint.
    The output from ListTables is paginated, with each page returning a maximum of 100 table names.
    for more information, see [AWS API Docs](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTables.html)
    Parameters
    ----------
    request : ListTablesRequest
        The request object containing the parameters for the operation.

    Returns
    -------
    ListTablesResponse
        The response object containing the results of the operation.

    Raises
    ------
    async_boto.core.exceptions.ClientError
        if the request fails.

    Examples
    --------
    >>> from async_boto.clients.dynamodb import AsyncDynamoDBClient
    >>> from async_boto.clients.dynamodb import (
    ...     ListTablesRequest,
    ...     ListTablesResponse,
    ... )
    >>> request = ListTablesRequest()
    >>> response = await dynamodb_client.list_tables(request=request)

    >>> assert isinstance(response, ListTablesResponse)
    >>> assert test_table in response.TableNames
    """  # noqa: E501
    return await self._make_request(
        "DynamoDB_20120810.ListTables", request, ListTablesResponse
    )

get_item async

get_item(request)
Source code in async_boto/clients/dynamodb.py
585
586
587
588
async def get_item(self, request: GetItemRequest) -> GetItemResponse:
    return await self._make_request(
        "DynamoDB_20120810.GetItem", request, GetItemResponse
    )

batch_get_item async

batch_get_item(request)
Source code in async_boto/clients/dynamodb.py
590
591
592
593
594
595
async def batch_get_item(
    self, request: BatchGetItemRequest
) -> BatchGetItemResponse:
    return await self._make_request(
        "DynamoDB_20120810.BatchGetItem", request, BatchGetItemResponse
    )

delete_item async

delete_item(request)
Source code in async_boto/clients/dynamodb.py
597
598
599
600
async def delete_item(self, request: DeleteItemRequest) -> DeleteItemResponse:
    return await self._make_request(
        "DynamoDB_20120810.DeleteItem", request, DeleteItemResponse
    )

create_backup async

create_backup(request)
Source code in async_boto/clients/dynamodb.py
602
603
604
605
async def create_backup(self, request: CreateBackupRequest) -> CreateBackupResponse:
    return await self._make_request(
        "DynamoDB_20120810.CreateBackup", request, CreateBackupResponse
    )

batch_execute_statement async

batch_execute_statement(request)

This operation allows you to perform batch reads or writes on data stored in DynamoDB, using PartiQL. Each read statement in a BatchExecuteStatement must specify an equality condition on all key attributes. This enforces that each SELECT statement in a batch returns at most a single item. For more information, see AWS API Docs

PARAMETER DESCRIPTION
request

The request object containing the parameters for the operation.

TYPE: BatchExecuteStatementRequest

RETURNS DESCRIPTION
BatchExecuteStatementResponse

The response object containing the results of the operation.

RAISES DESCRIPTION
ClientError

if the request fails.

Examples:

>>> from async_boto.core.session import AsyncAWSSession
>>> from async_boto.clients.dynamodb import (
...     AsyncDynamoDBClient,
...     BatchExecuteStatementRequest,
...     BatchExecuteStatementResponse,
...     PutItemRequest,
... )
>>> from async_boto.validation.dynamodb.data_types.batch_statement_request import (
...     BatchStatementRequest,
... )
>>> dynamodb_client = AsyncDynamoDBClient()
>>> batch_statement_request = BatchStatementRequest(
...     Statement=f"SELECT * FROM "{test_table}" WHERE hash = 'hash2' and sort='sort2'",
...     ConsistentRead=True,
... )
>>> request = BatchExecuteStatementRequest(Statements=[batch_statement_request])
>>> response = await dynamodb_client.batch_execute_statement(request=request)
>>> assert isinstance(response, BatchExecuteStatementResponse)
>>> assert response.Responses[0].Item.to_python_dict() == {
...     "hash": "hash2",
...     "sort": "sort2",
... }
Source code in async_boto/clients/dynamodb.py
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
async def batch_execute_statement(
    self, request: BatchExecuteStatementRequest
) -> BatchExecuteStatementResponse:
    """
    This operation allows you to perform batch reads or writes on data stored in
    DynamoDB, using PartiQL. Each read statement in a BatchExecuteStatement must
    specify an equality condition on all key attributes.
    This enforces that each SELECT statement in a batch returns at
    most a single item. For more information, see
    [AWS API Docs](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchExecuteStatement.html)

    Parameters
    ----------
    request : BatchExecuteStatementRequest
        The request object containing the parameters for the operation.

    Returns
    -------
    BatchExecuteStatementResponse
        The response object containing the results of the operation.

    Raises
    -------
    async_boto.core.exceptions.ClientError
        if the request fails.

    Examples
    --------
    >>> from async_boto.core.session import AsyncAWSSession
    >>> from async_boto.clients.dynamodb import (
    ...     AsyncDynamoDBClient,
    ...     BatchExecuteStatementRequest,
    ...     BatchExecuteStatementResponse,
    ...     PutItemRequest,
    ... )
    >>> from async_boto.validation.dynamodb.data_types.batch_statement_request import (
    ...     BatchStatementRequest,
    ... )
    >>> dynamodb_client = AsyncDynamoDBClient()
    >>> batch_statement_request = BatchStatementRequest(
    ...     Statement=f"SELECT * FROM \"{test_table}\" WHERE hash = 'hash2' and sort='sort2'",
    ...     ConsistentRead=True,
    ... )
    >>> request = BatchExecuteStatementRequest(Statements=[batch_statement_request])
    >>> response = await dynamodb_client.batch_execute_statement(request=request)
    >>> assert isinstance(response, BatchExecuteStatementResponse)
    >>> assert response.Responses[0].Item.to_python_dict() == {
    ...     "hash": "hash2",
    ...     "sort": "sort2",
    ... }
    """  # noqa: E501
    return await self._make_request(
        "DynamoDB_20120810.BatchExecuteStatement",
        request,
        BatchExecuteStatementResponse,
    )

create_global_table async

create_global_table(request)
Source code in async_boto/clients/dynamodb.py
664
665
666
667
668
669
async def create_global_table(
    self, request: CreateGlobalTableRequest
) -> CreateGlobalTableResponse:
    return await self._make_request(
        "DynamoDB_20120810.CreateGlobalTable", request, CreateGlobalTableResponse
    )

create_table async

create_table(request)
Source code in async_boto/clients/dynamodb.py
671
672
673
674
async def create_table(self, request: CreateTableRequest) -> CreateTableResponse:
    return await self._make_request(
        "DynamoDB_20120810.CreateTable", request, CreateTableResponse
    )

delete_backup async

delete_backup(request)
Source code in async_boto/clients/dynamodb.py
676
677
678
679
async def delete_backup(self, request: DeleteBackupRequest) -> DeleteBackupResponse:
    return await self._make_request(
        "DynamoDB_20120810.DeleteBackup", request, DeleteBackupResponse
    )

delete_resource_policy async

delete_resource_policy(request)
Source code in async_boto/clients/dynamodb.py
681
682
683
684
685
686
687
688
async def delete_resource_policy(
    self, request: DeleteResourcePolicyRequest
) -> DeleteResourcePolicyResponse:
    return await self._make_request(
        "DynamoDB_20120810.DeleteResourcePolicy",
        request,
        DeleteResourcePolicyResponse,
    )

delete_table async

delete_table(request)
Source code in async_boto/clients/dynamodb.py
690
691
692
693
async def delete_table(self, request: DeleteTableRequest) -> DeleteTableResponse:
    return await self._make_request(
        "DynamoDB_20120810.DeleteTable", request, DeleteTableResponse
    )

describe_backup async

describe_backup(request)
Source code in async_boto/clients/dynamodb.py
695
696
697
698
699
700
async def describe_backup(
    self, request: DescribeBackupRequest
) -> DescribeBackupResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeBackup", request, DescribeBackupResponse
    )

describe_continuous_backups async

describe_continuous_backups(request)
Source code in async_boto/clients/dynamodb.py
702
703
704
705
706
707
708
709
async def describe_continuous_backups(
    self, request: DescribeContinuousBackupsRequest
) -> DescribeContinuousBackupsResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeContinuousBackups",
        request,
        DescribeContinuousBackupsResponse,
    )

describe_contributor_insights async

describe_contributor_insights(request)
Source code in async_boto/clients/dynamodb.py
711
712
713
714
715
716
717
718
async def describe_contributor_insights(
    self, request: DescribeContributorInsightsRequest
) -> DescribeContributorInsightsResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeContributorInsights",
        request,
        DescribeContributorInsightsResponse,
    )

describe_export async

describe_export(request)
Source code in async_boto/clients/dynamodb.py
720
721
722
723
724
725
async def describe_export(
    self, request: DescribeExportRequest
) -> DescribeExportResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeExport", request, DescribeExportResponse
    )

describe_global_table async

describe_global_table(request)
Source code in async_boto/clients/dynamodb.py
727
728
729
730
731
732
733
734
async def describe_global_table(
    self, request: DescribeGlobalTableRequest
) -> DescribeGlobalTableResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeGlobalTable",
        request,
        DescribeGlobalTableResponse,
    )

describe_global_table_settings async

describe_global_table_settings(request)
Source code in async_boto/clients/dynamodb.py
736
737
738
739
740
741
742
743
async def describe_global_table_settings(
    self, request: DescribeGlobalTableSettingsRequest
) -> DescribeGlobalTableSettingsResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeGlobalTableSettings",
        request,
        DescribeGlobalTableSettingsResponse,
    )

describe_import async

describe_import(request)
Source code in async_boto/clients/dynamodb.py
745
746
747
748
749
750
async def describe_import(
    self, request: DescribeImportRequest
) -> DescribeImportResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeImport", request, DescribeImportResponse
    )

describe_kinesis_streaming_destination async

describe_kinesis_streaming_destination(request)
Source code in async_boto/clients/dynamodb.py
752
753
754
755
756
757
758
759
async def describe_kinesis_streaming_destination(
    self, request: DescribeKinesisStreamingDestinationRequest
) -> DescribeKinesisStreamingDestinationResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeKinesisStreamingDestination",
        request,
        DescribeKinesisStreamingDestinationResponse,
    )

describe_table_replica_auto_scaling async

describe_table_replica_auto_scaling(request)
Source code in async_boto/clients/dynamodb.py
761
762
763
764
765
766
767
768
async def describe_table_replica_auto_scaling(
    self, request: DescribeTableReplicaAutoScalingRequest
) -> DescribeTableReplicaAutoScalingResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeTableReplicaAutoScaling",
        request,
        DescribeTableReplicaAutoScalingResponse,
    )

describe_time_to_live async

describe_time_to_live(request)
Source code in async_boto/clients/dynamodb.py
770
771
772
773
774
775
async def describe_time_to_live(
    self, request: DescribeTimeToLiveRequest
) -> DescribeTimeToLiveResponse:
    return await self._make_request(
        "DynamoDB_20120810.DescribeTimeToLive", request, DescribeTimeToLiveResponse
    )

disable_kinesis_streaming_destination async

disable_kinesis_streaming_destination(request)
Source code in async_boto/clients/dynamodb.py
777
778
779
780
781
782
783
784
async def disable_kinesis_streaming_destination(
    self, request: DisableKinesisStreamingDestinationRequest
) -> DisableKinesisStreamingDestinationResponse:
    return await self._make_request(
        "DynamoDB_20120810.DisableKinesisStreamingDestination",
        request,
        DisableKinesisStreamingDestinationResponse,
    )

enable_kinesis_streaming_destination async

enable_kinesis_streaming_destination(request)
Source code in async_boto/clients/dynamodb.py
786
787
788
789
790
791
792
793
async def enable_kinesis_streaming_destination(
    self, request: EnableKinesisStreamingDestinationRequest
) -> EnableKinesisStreamingDestinationResponse:
    return await self._make_request(
        "DynamoDB_20120810.EnableKinesisStreamingDestination",
        request,
        EnableKinesisStreamingDestinationResponse,
    )

execute_statement async

execute_statement(request)
Source code in async_boto/clients/dynamodb.py
795
796
797
798
799
800
async def execute_statement(
    self, request: ExecuteStatementRequest
) -> ExecuteStatementResponse:
    return await self._make_request(
        "DynamoDB_20120810.ExecuteStatement", request, ExecuteStatementResponse
    )

execute_transaction async

execute_transaction(request)
Source code in async_boto/clients/dynamodb.py
802
803
804
805
806
807
async def execute_transaction(
    self, request: ExecuteTransactionRequest
) -> ExecuteTransactionResponse:
    return await self._make_request(
        "DynamoDB_20120810.ExecuteTransaction", request, ExecuteTransactionResponse
    )

export_table_to_point_in_time async

export_table_to_point_in_time(request)
Source code in async_boto/clients/dynamodb.py
809
810
811
812
813
814
815
816
async def export_table_to_point_in_time(
    self, request: ExportTableToPointInTimeRequest
) -> ExportTableToPointInTimeResponse:
    return await self._make_request(
        "DynamoDB_20120810.ExportTableToPointInTime",
        request,
        ExportTableToPointInTimeResponse,
    )

get_resource_policy async

get_resource_policy(request)
Source code in async_boto/clients/dynamodb.py
818
819
820
821
822
823
async def get_resource_policy(
    self, request: GetResourcePolicyRequest
) -> GetResourcePolicyResponse:
    return await self._make_request(
        "DynamoDB_20120810.GetResourcePolicy", request, GetResourcePolicyResponse
    )

import_table async

import_table(request)
Source code in async_boto/clients/dynamodb.py
825
826
827
828
async def import_table(self, request: ImportTableRequest) -> ImportTableResponse:
    return await self._make_request(
        "DynamoDB_20120810.ImportTable", request, ImportTableResponse
    )

list_backups async

list_backups(request)
Source code in async_boto/clients/dynamodb.py
830
831
832
833
834
835
836
837
@register_paginator(
    pagination_query_key="ExclusiveStartBackupArn",
    pagination_response_key="LastEvaluatedBackupArn",
)
async def list_backups(self, request: ListBackupsRequest) -> ListBackupsResponse:
    return await self._make_request(
        "DynamoDB_20120810.ListBackups", request, ListBackupsResponse
    )

list_contributor_insights async

list_contributor_insights(request)
Source code in async_boto/clients/dynamodb.py
839
840
841
842
843
844
845
846
847
848
849
850
@register_paginator(
    pagination_query_key="NextToken",
    pagination_response_key="NextToken",
)
async def list_contributor_insights(
    self, request: ListContributorInsightsRequest
) -> ListContributorInsightsResponse:
    return await self._make_request(
        "DynamoDB_20120810.ListContributorInsights",
        request,
        ListContributorInsightsResponse,
    )

list_exports async

list_exports(request)
Source code in async_boto/clients/dynamodb.py
852
853
854
855
856
857
858
859
@register_paginator(
    pagination_query_key="NextToken",
    pagination_response_key="NextToken",
)
async def list_exports(self, request: ListExportsRequest) -> ListExportsResponse:
    return await self._make_request(
        "DynamoDB_20120810.ListExports", request, ListExportsResponse
    )

list_global_tables async

list_global_tables(request)
Source code in async_boto/clients/dynamodb.py
861
862
863
864
865
866
867
868
869
870
@register_paginator(
    pagination_query_key="ExclusiveStartGlobalTableName",
    pagination_response_key="LastEvaluatedGlobalTableName",
)
async def list_global_tables(
    self, request: ListGlobalTablesRequest
) -> ListGlobalTablesResponse:
    return await self._make_request(
        "DynamoDB_20120810.ListGlobalTables", request, ListGlobalTablesResponse
    )

list_imports async

list_imports(request)
Source code in async_boto/clients/dynamodb.py
872
873
874
875
876
877
878
@register_paginator(
    pagination_query_key="NextToken", pagination_response_key="NextToken"
)
async def list_imports(self, request: ListImportsRequest) -> ListImportsResponse:
    return await self._make_request(
        "DynamoDB_20120810.ListImports", request, ListImportsResponse
    )

list_tags_of_resource async

list_tags_of_resource(request)
Source code in async_boto/clients/dynamodb.py
880
881
882
883
884
885
886
887
888
889
@register_paginator(
    pagination_query_key="NextToken",
    pagination_response_key="NextToken",
)
async def list_tags_of_resource(
    self, request: ListTagsOfResourceRequest
) -> ListTagsOfResourceResponse:
    return await self._make_request(
        "DynamoDB_20120810.ListTagsOfResource", request, ListTagsOfResourceResponse
    )

put_resource_policy async

put_resource_policy(request)
Source code in async_boto/clients/dynamodb.py
891
892
893
894
895
896
async def put_resource_policy(
    self, request: PutResourcePolicyRequest
) -> PutResourcePolicyResponse:
    return await self._make_request(
        "DynamoDB_20120810.PutResourcePolicy", request, PutResourcePolicyResponse
    )

restore_table_from_backup async

restore_table_from_backup(request)
Source code in async_boto/clients/dynamodb.py
898
899
900
901
902
903
904
905
async def restore_table_from_backup(
    self, request: RestoreTableFromBackupRequest
) -> RestoreTableFromBackupResponse:
    return await self._make_request(
        "DynamoDB_20120810.RestoreTableFromBackup",
        request,
        RestoreTableFromBackupResponse,
    )

restore_table_to_point_in_time async

restore_table_to_point_in_time(request)
Source code in async_boto/clients/dynamodb.py
907
908
909
910
911
912
913
914
async def restore_table_to_point_in_time(
    self, request: RestoreTableToPointInTimeRequest
) -> RestoreTableToPointInTimeResponse:
    return await self._make_request(
        "DynamoDB_20120810.RestoreTableToPointInTime",
        request,
        RestoreTableToPointInTimeResponse,
    )

tag_resource async

tag_resource(request)
Source code in async_boto/clients/dynamodb.py
916
917
918
919
async def tag_resource(self, request: TagResourceRequest) -> TagResourceResponse:
    return await self._make_request(
        "DynamoDB_20120810.TagResource", request, TagResourceResponse
    )

transact_get_items async

transact_get_items(request)
Source code in async_boto/clients/dynamodb.py
921
922
923
924
925
926
async def transact_get_items(
    self, request: TransactGetItemsRequest
) -> TransactGetItemsResponse:
    return await self._make_request(
        "DynamoDB_20120810.TransactGetItems", request, TransactGetItemsResponse
    )

transact_write_items async

transact_write_items(request)
Source code in async_boto/clients/dynamodb.py
928
929
930
931
932
933
async def transact_write_items(
    self, request: TransactWriteItemsRequest
) -> TransactWriteItemsResponse:
    return await self._make_request(
        "DynamoDB_20120810.TransactWriteItems", request, TransactWriteItemsResponse
    )

untag_resource async

untag_resource(request)
Source code in async_boto/clients/dynamodb.py
935
936
937
938
939
940
async def untag_resource(
    self, request: UntagResourceRequest
) -> UntagResourceResponse:
    return await self._make_request(
        "DynamoDB_20120810.UntagResource", request, UntagResourceResponse
    )

update_continuous_backups async

update_continuous_backups(request)
Source code in async_boto/clients/dynamodb.py
942
943
944
945
946
947
948
949
async def update_continuous_backups(
    self, request: UpdateContinuousBackupsRequest
) -> UpdateContinuousBackupsResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateContinuousBackups",
        request,
        UpdateContinuousBackupsResponse,
    )

update_contributor_insights async

update_contributor_insights(request)
Source code in async_boto/clients/dynamodb.py
951
952
953
954
955
956
957
958
async def update_contributor_insights(
    self, request: UpdateContributorInsightsRequest
) -> UpdateContributorInsightsResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateContributorInsights",
        request,
        UpdateContributorInsightsResponse,
    )

update_global_table async

update_global_table(request)
Source code in async_boto/clients/dynamodb.py
960
961
962
963
964
965
async def update_global_table(
    self, request: UpdateGlobalTableRequest
) -> UpdateGlobalTableResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateGlobalTable", request, UpdateGlobalTableResponse
    )

update_global_table_settings async

update_global_table_settings(request)
Source code in async_boto/clients/dynamodb.py
967
968
969
970
971
972
973
974
async def update_global_table_settings(
    self, request: UpdateGlobalTableSettingsRequest
) -> UpdateGlobalTableSettingsResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateGlobalTableSettings",
        request,
        UpdateGlobalTableSettingsResponse,
    )

update_item async

update_item(request)
Source code in async_boto/clients/dynamodb.py
976
977
978
979
async def update_item(self, request: UpdateItemRequest) -> UpdateItemResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateItem", request, UpdateItemResponse
    )

update_kinesis_streaming_destination async

update_kinesis_streaming_destination(request)
Source code in async_boto/clients/dynamodb.py
981
982
983
984
985
986
987
988
async def update_kinesis_streaming_destination(
    self, request: UpdateKinesisStreamingDestinationRequest
) -> UpdateKinesisStreamingDestinationResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateKinesisStreamingDestination",
        request,
        UpdateKinesisStreamingDestinationResponse,
    )

update_table async

update_table(request)
Source code in async_boto/clients/dynamodb.py
990
991
992
993
async def update_table(self, request: UpdateTableRequest) -> UpdateTableResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateTable", request, UpdateTableResponse
    )

update_table_replica_auto_scaling async

update_table_replica_auto_scaling(request)
Source code in async_boto/clients/dynamodb.py
 995
 996
 997
 998
 999
1000
1001
1002
async def update_table_replica_auto_scaling(
    self, request: UpdateTableReplicaAutoScalingRequest
) -> UpdateTableReplicaAutoScalingResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateTableReplicaAutoScaling",
        request,
        UpdateTableReplicaAutoScalingResponse,
    )

update_time_to_live async

update_time_to_live(request)
Source code in async_boto/clients/dynamodb.py
1004
1005
1006
1007
1008
1009
async def update_time_to_live(
    self, request: UpdateTimeToLiveRequest
) -> UpdateTimeToLiveResponse:
    return await self._make_request(
        "DynamoDB_20120810.UpdateTimeToLive", request, UpdateTimeToLiveResponse
    )

paginate async

paginate(method_name, request)
Source code in async_boto/core/base_client.py
255
256
257
258
259
260
261
262
263
async def paginate(self, method_name, request: BaseModel):
    if method_name not in self._paginators:
        raise ValueError(
            f"Method {method_name} is not paginatable. "
            f"Available methods: {list(self._paginators.keys())}"
        )
    paginator = paginate(self, request=request, **self._paginators[method_name])
    async for page in paginator:
        yield page