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 | |
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 | |
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:
|
| 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 | |
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:
|
| 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 | |
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:
|
| 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 | |
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:
|
| 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 | |
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:
|
| 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 | |
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:
|
| 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 | |
get_item
async
get_item(request)
Source code in async_boto/clients/dynamodb.py
585 586 587 588 | |
batch_get_item
async
batch_get_item(request)
Source code in async_boto/clients/dynamodb.py
590 591 592 593 594 595 | |
delete_item
async
delete_item(request)
Source code in async_boto/clients/dynamodb.py
597 598 599 600 | |
create_backup
async
create_backup(request)
Source code in async_boto/clients/dynamodb.py
602 603 604 605 | |
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. |
| 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 | |
create_global_table
async
create_global_table(request)
Source code in async_boto/clients/dynamodb.py
664 665 666 667 668 669 | |
create_table
async
create_table(request)
Source code in async_boto/clients/dynamodb.py
671 672 673 674 | |
delete_backup
async
delete_backup(request)
Source code in async_boto/clients/dynamodb.py
676 677 678 679 | |
delete_resource_policy
async
delete_resource_policy(request)
Source code in async_boto/clients/dynamodb.py
681 682 683 684 685 686 687 688 | |
delete_table
async
delete_table(request)
Source code in async_boto/clients/dynamodb.py
690 691 692 693 | |
describe_backup
async
describe_backup(request)
Source code in async_boto/clients/dynamodb.py
695 696 697 698 699 700 | |
describe_continuous_backups
async
describe_continuous_backups(request)
Source code in async_boto/clients/dynamodb.py
702 703 704 705 706 707 708 709 | |
describe_contributor_insights
async
describe_contributor_insights(request)
Source code in async_boto/clients/dynamodb.py
711 712 713 714 715 716 717 718 | |
describe_export
async
describe_export(request)
Source code in async_boto/clients/dynamodb.py
720 721 722 723 724 725 | |
describe_global_table
async
describe_global_table(request)
Source code in async_boto/clients/dynamodb.py
727 728 729 730 731 732 733 734 | |
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 | |
describe_import
async
describe_import(request)
Source code in async_boto/clients/dynamodb.py
745 746 747 748 749 750 | |
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 | |
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 | |
describe_time_to_live
async
describe_time_to_live(request)
Source code in async_boto/clients/dynamodb.py
770 771 772 773 774 775 | |
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 | |
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 | |
execute_statement
async
execute_statement(request)
Source code in async_boto/clients/dynamodb.py
795 796 797 798 799 800 | |
execute_transaction
async
execute_transaction(request)
Source code in async_boto/clients/dynamodb.py
802 803 804 805 806 807 | |
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 | |
get_resource_policy
async
get_resource_policy(request)
Source code in async_boto/clients/dynamodb.py
818 819 820 821 822 823 | |
import_table
async
import_table(request)
Source code in async_boto/clients/dynamodb.py
825 826 827 828 | |
list_backups
async
list_backups(request)
Source code in async_boto/clients/dynamodb.py
830 831 832 833 834 835 836 837 | |
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 | |
list_exports
async
list_exports(request)
Source code in async_boto/clients/dynamodb.py
852 853 854 855 856 857 858 859 | |
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 | |
list_imports
async
list_imports(request)
Source code in async_boto/clients/dynamodb.py
872 873 874 875 876 877 878 | |
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 | |
put_resource_policy
async
put_resource_policy(request)
Source code in async_boto/clients/dynamodb.py
891 892 893 894 895 896 | |
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 | |
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 | |
tag_resource
async
tag_resource(request)
Source code in async_boto/clients/dynamodb.py
916 917 918 919 | |
transact_get_items
async
transact_get_items(request)
Source code in async_boto/clients/dynamodb.py
921 922 923 924 925 926 | |
transact_write_items
async
transact_write_items(request)
Source code in async_boto/clients/dynamodb.py
928 929 930 931 932 933 | |
untag_resource
async
untag_resource(request)
Source code in async_boto/clients/dynamodb.py
935 936 937 938 939 940 | |
update_continuous_backups
async
update_continuous_backups(request)
Source code in async_boto/clients/dynamodb.py
942 943 944 945 946 947 948 949 | |
update_contributor_insights
async
update_contributor_insights(request)
Source code in async_boto/clients/dynamodb.py
951 952 953 954 955 956 957 958 | |
update_global_table
async
update_global_table(request)
Source code in async_boto/clients/dynamodb.py
960 961 962 963 964 965 | |
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 | |
update_item
async
update_item(request)
Source code in async_boto/clients/dynamodb.py
976 977 978 979 | |
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 | |
update_table
async
update_table(request)
Source code in async_boto/clients/dynamodb.py
990 991 992 993 | |
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 | |
update_time_to_live
async
update_time_to_live(request)
Source code in async_boto/clients/dynamodb.py
1004 1005 1006 1007 1008 1009 | |
paginate
async
paginate(method_name, request)
Source code in async_boto/core/base_client.py
255 256 257 258 259 260 261 262 263 | |