types-boto3-dynamodb 1.36.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,356 @@
1
+ """
2
+ Type annotations for dynamodb service ServiceResource.
3
+
4
+ [Documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/)
5
+
6
+ Usage::
7
+
8
+ ```python
9
+ from boto3.session import Session
10
+
11
+ from types_boto3_dynamodb.service_resource import DynamoDBServiceResource
12
+ import types_boto3_dynamodb.service_resource as dynamodb_resources
13
+
14
+ session = Session()
15
+ resource: DynamoDBServiceResource = session.resource("dynamodb")
16
+
17
+ my_table: dynamodb_resources.Table = resource.Table(...)
18
+ ```
19
+
20
+ Copyright 2025 Vlad Emelianov
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ import sys
26
+ from datetime import datetime
27
+
28
+ from boto3.dynamodb.table import BatchWriter
29
+ from boto3.resources.base import ResourceMeta, ServiceResource
30
+ from boto3.resources.collection import ResourceCollection
31
+
32
+ from .client import DynamoDBClient
33
+ from .literals import MultiRegionConsistencyType, TableStatusType
34
+ from .type_defs import (
35
+ ArchivalSummaryTypeDef,
36
+ AttributeDefinitionTypeDef,
37
+ BatchGetItemInputServiceResourceBatchGetItemTypeDef,
38
+ BatchGetItemOutputServiceResourceTypeDef,
39
+ BatchWriteItemInputServiceResourceBatchWriteItemTypeDef,
40
+ BatchWriteItemOutputServiceResourceTypeDef,
41
+ BillingModeSummaryTypeDef,
42
+ CreateTableInputServiceResourceCreateTableTypeDef,
43
+ DeleteItemInputTableDeleteItemTypeDef,
44
+ DeleteItemOutputTableTypeDef,
45
+ DeleteTableOutputTypeDef,
46
+ GetItemInputTableGetItemTypeDef,
47
+ GetItemOutputTableTypeDef,
48
+ GlobalSecondaryIndexDescriptionTypeDef,
49
+ KeySchemaElementTypeDef,
50
+ LocalSecondaryIndexDescriptionTypeDef,
51
+ OnDemandThroughputTypeDef,
52
+ ProvisionedThroughputDescriptionTypeDef,
53
+ PutItemInputTablePutItemTypeDef,
54
+ PutItemOutputTableTypeDef,
55
+ QueryInputTableQueryTypeDef,
56
+ QueryOutputTableTypeDef,
57
+ ReplicaDescriptionTypeDef,
58
+ RestoreSummaryTypeDef,
59
+ ScanInputTableScanTypeDef,
60
+ ScanOutputTableTypeDef,
61
+ SSEDescriptionTypeDef,
62
+ StreamSpecificationTypeDef,
63
+ TableClassSummaryTypeDef,
64
+ TableWarmThroughputDescriptionTypeDef,
65
+ UpdateItemInputTableUpdateItemTypeDef,
66
+ UpdateItemOutputTableTypeDef,
67
+ UpdateTableInputTableUpdateTypeDef,
68
+ )
69
+
70
+ if sys.version_info >= (3, 9):
71
+ from builtins import list as List
72
+ from collections.abc import Iterator, Sequence
73
+ else:
74
+ from typing import Iterator, List, Sequence
75
+ if sys.version_info >= (3, 12):
76
+ from typing import Unpack
77
+ else:
78
+ from typing_extensions import Unpack
79
+
80
+ __all__ = ("DynamoDBServiceResource", "ServiceResourceTablesCollection", "Table")
81
+
82
+ class ServiceResourceTablesCollection(ResourceCollection):
83
+ """
84
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#DynamoDB.ServiceResource.tables)
85
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
86
+ """
87
+ def all(self) -> ServiceResourceTablesCollection:
88
+ """
89
+ Get all items from the collection, optionally with a custom page size and item
90
+ count limit.
91
+
92
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#DynamoDB.ServiceResource.all)
93
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
94
+ """
95
+
96
+ def filter( # type: ignore[override]
97
+ self, *, ExclusiveStartTableName: str = ..., Limit: int = ...
98
+ ) -> ServiceResourceTablesCollection:
99
+ """
100
+ Get items from the collection, passing keyword arguments along as parameters to
101
+ the underlying service operation, which are typically used to filter the
102
+ results.
103
+
104
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#filter)
105
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
106
+ """
107
+
108
+ def limit(self, count: int) -> ServiceResourceTablesCollection:
109
+ """
110
+ Return at most this many Tables.
111
+
112
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#limit)
113
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
114
+ """
115
+
116
+ def page_size(self, count: int) -> ServiceResourceTablesCollection:
117
+ """
118
+ Fetch at most this many Tables per service request.
119
+
120
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#page_size)
121
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
122
+ """
123
+
124
+ def pages(self) -> Iterator[List[Table]]:
125
+ """
126
+ A generator which yields pages of Tables.
127
+
128
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#pages)
129
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
130
+ """
131
+
132
+ def __iter__(self) -> Iterator[Table]:
133
+ """
134
+ A generator which yields Tables.
135
+
136
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#__iter__)
137
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
138
+ """
139
+
140
+ class Table(ServiceResource):
141
+ """
142
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/index.html#DynamoDB.Table)
143
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#table)
144
+ """
145
+
146
+ name: str
147
+ attribute_definitions: List[AttributeDefinitionTypeDef]
148
+ table_name: str
149
+ key_schema: List[KeySchemaElementTypeDef]
150
+ table_status: TableStatusType
151
+ creation_date_time: datetime
152
+ provisioned_throughput: ProvisionedThroughputDescriptionTypeDef
153
+ table_size_bytes: int
154
+ item_count: int
155
+ table_arn: str
156
+ table_id: str
157
+ billing_mode_summary: BillingModeSummaryTypeDef
158
+ local_secondary_indexes: List[LocalSecondaryIndexDescriptionTypeDef]
159
+ global_secondary_indexes: List[GlobalSecondaryIndexDescriptionTypeDef]
160
+ stream_specification: StreamSpecificationTypeDef
161
+ latest_stream_label: str
162
+ latest_stream_arn: str
163
+ global_table_version: str
164
+ replicas: List[ReplicaDescriptionTypeDef]
165
+ restore_summary: RestoreSummaryTypeDef
166
+ sse_description: SSEDescriptionTypeDef
167
+ archival_summary: ArchivalSummaryTypeDef
168
+ table_class_summary: TableClassSummaryTypeDef
169
+ deletion_protection_enabled: bool
170
+ on_demand_throughput: OnDemandThroughputTypeDef
171
+ warm_throughput: TableWarmThroughputDescriptionTypeDef
172
+ multi_region_consistency: MultiRegionConsistencyType
173
+ meta: DynamoDBResourceMeta # type: ignore[override]
174
+
175
+ def get_available_subresources(self) -> Sequence[str]:
176
+ """
177
+ Returns a list of all the available sub-resources for this Table.
178
+
179
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/get_available_subresources.html)
180
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableget_available_subresources-method)
181
+ """
182
+
183
+ def delete(self) -> DeleteTableOutputTypeDef:
184
+ """
185
+ The <code>DeleteTable</code> operation deletes a table and all of its items.
186
+
187
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/delete.html)
188
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tabledelete-method)
189
+ """
190
+
191
+ def delete_item(
192
+ self, **kwargs: Unpack[DeleteItemInputTableDeleteItemTypeDef]
193
+ ) -> DeleteItemOutputTableTypeDef:
194
+ """
195
+ Deletes a single item in a table by primary key.
196
+
197
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/delete_item.html)
198
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tabledelete_item-method)
199
+ """
200
+
201
+ def get_item(
202
+ self, **kwargs: Unpack[GetItemInputTableGetItemTypeDef]
203
+ ) -> GetItemOutputTableTypeDef:
204
+ """
205
+ The <code>GetItem</code> operation returns a set of attributes for the item
206
+ with the given primary key.
207
+
208
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/get_item.html)
209
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableget_item-method)
210
+ """
211
+
212
+ def put_item(
213
+ self, **kwargs: Unpack[PutItemInputTablePutItemTypeDef]
214
+ ) -> PutItemOutputTableTypeDef:
215
+ """
216
+ Creates a new item, or replaces an old item with a new item.
217
+
218
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/put_item.html)
219
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableput_item-method)
220
+ """
221
+
222
+ def query(self, **kwargs: Unpack[QueryInputTableQueryTypeDef]) -> QueryOutputTableTypeDef:
223
+ """
224
+ You must provide the name of the partition key attribute and a single value for
225
+ that attribute.
226
+
227
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/query.html)
228
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablequery-method)
229
+ """
230
+
231
+ def scan(self, **kwargs: Unpack[ScanInputTableScanTypeDef]) -> ScanOutputTableTypeDef:
232
+ """
233
+ The <code>Scan</code> operation returns one or more items and item attributes
234
+ by accessing every item in a table or a secondary index.
235
+
236
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/scan.html)
237
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablescan-method)
238
+ """
239
+
240
+ def update(self, **kwargs: Unpack[UpdateTableInputTableUpdateTypeDef]) -> _Table:
241
+ """
242
+ Modifies the provisioned throughput settings, global secondary indexes, or
243
+ DynamoDB Streams settings for a given table.
244
+
245
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/update.html)
246
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableupdate-method)
247
+ """
248
+
249
+ def update_item(
250
+ self, **kwargs: Unpack[UpdateItemInputTableUpdateItemTypeDef]
251
+ ) -> UpdateItemOutputTableTypeDef:
252
+ """
253
+ Edits an existing item's attributes, or adds a new item to the table if it does
254
+ not already exist.
255
+
256
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/update_item.html)
257
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableupdate_item-method)
258
+ """
259
+
260
+ def wait_until_exists(self) -> None:
261
+ """
262
+ Waits until Table is exists.
263
+
264
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/wait_until_exists.html)
265
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablewait_until_exists-method)
266
+ """
267
+
268
+ def wait_until_not_exists(self) -> None:
269
+ """
270
+ Waits until Table is not_exists.
271
+
272
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/wait_until_not_exists.html)
273
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablewait_until_not_exists-method)
274
+ """
275
+
276
+ def batch_writer(self, overwrite_by_pkeys: List[str] = ...) -> BatchWriter:
277
+ """
278
+ Create a batch writer object.
279
+
280
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/batch_writer.html)
281
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablebatch_writer-method)
282
+ """
283
+
284
+ def load(self) -> None:
285
+ """
286
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/load.html)
287
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableload-method)
288
+ """
289
+
290
+ def reload(self) -> None:
291
+ """
292
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/reload.html)
293
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablereload-method)
294
+ """
295
+
296
+ _Table = Table
297
+
298
+ class DynamoDBResourceMeta(ResourceMeta):
299
+ client: DynamoDBClient # type: ignore[override]
300
+
301
+ class DynamoDBServiceResource(ServiceResource):
302
+ """
303
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/index.html)
304
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/)
305
+ """
306
+
307
+ meta: DynamoDBResourceMeta # type: ignore[override]
308
+ tables: ServiceResourceTablesCollection
309
+
310
+ def get_available_subresources(self) -> Sequence[str]:
311
+ """
312
+ Returns a list of all the available sub-resources for this resource.
313
+
314
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/get_available_subresources.html)
315
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourceget_available_subresources-method)
316
+ """
317
+
318
+ def batch_get_item(
319
+ self, **kwargs: Unpack[BatchGetItemInputServiceResourceBatchGetItemTypeDef]
320
+ ) -> BatchGetItemOutputServiceResourceTypeDef:
321
+ """
322
+ The <code>BatchGetItem</code> operation returns the attributes of one or more
323
+ items from one or more tables.
324
+
325
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/batch_get_item.html)
326
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourcebatch_get_item-method)
327
+ """
328
+
329
+ def batch_write_item(
330
+ self, **kwargs: Unpack[BatchWriteItemInputServiceResourceBatchWriteItemTypeDef]
331
+ ) -> BatchWriteItemOutputServiceResourceTypeDef:
332
+ """
333
+ The <code>BatchWriteItem</code> operation puts or deletes multiple items in one
334
+ or more tables.
335
+
336
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/batch_write_item.html)
337
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourcebatch_write_item-method)
338
+ """
339
+
340
+ def create_table(
341
+ self, **kwargs: Unpack[CreateTableInputServiceResourceCreateTableTypeDef]
342
+ ) -> _Table:
343
+ """
344
+ The <code>CreateTable</code> operation adds a new table to your account.
345
+
346
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/create_table.html)
347
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourcecreate_table-method)
348
+ """
349
+
350
+ def Table(self, name: str) -> _Table:
351
+ """
352
+ Creates a Table resource.
353
+
354
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/Table.html)
355
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourcetable-method)
356
+ """