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,363 @@
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
+
81
+ __all__ = ("DynamoDBServiceResource", "ServiceResourceTablesCollection", "Table")
82
+
83
+
84
+ class ServiceResourceTablesCollection(ResourceCollection):
85
+ """
86
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#DynamoDB.ServiceResource.tables)
87
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
88
+ """
89
+
90
+ def all(self) -> ServiceResourceTablesCollection:
91
+ """
92
+ Get all items from the collection, optionally with a custom page size and item
93
+ count limit.
94
+
95
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#DynamoDB.ServiceResource.all)
96
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
97
+ """
98
+
99
+ def filter( # type: ignore[override]
100
+ self, *, ExclusiveStartTableName: str = ..., Limit: int = ...
101
+ ) -> ServiceResourceTablesCollection:
102
+ """
103
+ Get items from the collection, passing keyword arguments along as parameters to
104
+ the underlying service operation, which are typically used to filter the
105
+ results.
106
+
107
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#filter)
108
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
109
+ """
110
+
111
+ def limit(self, count: int) -> ServiceResourceTablesCollection:
112
+ """
113
+ Return at most this many Tables.
114
+
115
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#limit)
116
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
117
+ """
118
+
119
+ def page_size(self, count: int) -> ServiceResourceTablesCollection:
120
+ """
121
+ Fetch at most this many Tables per service request.
122
+
123
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#page_size)
124
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
125
+ """
126
+
127
+ def pages(self) -> Iterator[List[Table]]:
128
+ """
129
+ A generator which yields pages of Tables.
130
+
131
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#pages)
132
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
133
+ """
134
+
135
+ def __iter__(self) -> Iterator[Table]:
136
+ """
137
+ A generator which yields Tables.
138
+
139
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html#__iter__)
140
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#serviceresourcetablescollection)
141
+ """
142
+
143
+
144
+ class Table(ServiceResource):
145
+ """
146
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/index.html#DynamoDB.Table)
147
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#table)
148
+ """
149
+
150
+ name: str
151
+ attribute_definitions: List[AttributeDefinitionTypeDef]
152
+ table_name: str
153
+ key_schema: List[KeySchemaElementTypeDef]
154
+ table_status: TableStatusType
155
+ creation_date_time: datetime
156
+ provisioned_throughput: ProvisionedThroughputDescriptionTypeDef
157
+ table_size_bytes: int
158
+ item_count: int
159
+ table_arn: str
160
+ table_id: str
161
+ billing_mode_summary: BillingModeSummaryTypeDef
162
+ local_secondary_indexes: List[LocalSecondaryIndexDescriptionTypeDef]
163
+ global_secondary_indexes: List[GlobalSecondaryIndexDescriptionTypeDef]
164
+ stream_specification: StreamSpecificationTypeDef
165
+ latest_stream_label: str
166
+ latest_stream_arn: str
167
+ global_table_version: str
168
+ replicas: List[ReplicaDescriptionTypeDef]
169
+ restore_summary: RestoreSummaryTypeDef
170
+ sse_description: SSEDescriptionTypeDef
171
+ archival_summary: ArchivalSummaryTypeDef
172
+ table_class_summary: TableClassSummaryTypeDef
173
+ deletion_protection_enabled: bool
174
+ on_demand_throughput: OnDemandThroughputTypeDef
175
+ warm_throughput: TableWarmThroughputDescriptionTypeDef
176
+ multi_region_consistency: MultiRegionConsistencyType
177
+ meta: DynamoDBResourceMeta # type: ignore[override]
178
+
179
+ def get_available_subresources(self) -> Sequence[str]:
180
+ """
181
+ Returns a list of all the available sub-resources for this Table.
182
+
183
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/get_available_subresources.html)
184
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableget_available_subresources-method)
185
+ """
186
+
187
+ def delete(self) -> DeleteTableOutputTypeDef:
188
+ """
189
+ The <code>DeleteTable</code> operation deletes a table and all of its items.
190
+
191
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/delete.html)
192
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tabledelete-method)
193
+ """
194
+
195
+ def delete_item(
196
+ self, **kwargs: Unpack[DeleteItemInputTableDeleteItemTypeDef]
197
+ ) -> DeleteItemOutputTableTypeDef:
198
+ """
199
+ Deletes a single item in a table by primary key.
200
+
201
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/delete_item.html)
202
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tabledelete_item-method)
203
+ """
204
+
205
+ def get_item(
206
+ self, **kwargs: Unpack[GetItemInputTableGetItemTypeDef]
207
+ ) -> GetItemOutputTableTypeDef:
208
+ """
209
+ The <code>GetItem</code> operation returns a set of attributes for the item
210
+ with the given primary key.
211
+
212
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/get_item.html)
213
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableget_item-method)
214
+ """
215
+
216
+ def put_item(
217
+ self, **kwargs: Unpack[PutItemInputTablePutItemTypeDef]
218
+ ) -> PutItemOutputTableTypeDef:
219
+ """
220
+ Creates a new item, or replaces an old item with a new item.
221
+
222
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/put_item.html)
223
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableput_item-method)
224
+ """
225
+
226
+ def query(self, **kwargs: Unpack[QueryInputTableQueryTypeDef]) -> QueryOutputTableTypeDef:
227
+ """
228
+ You must provide the name of the partition key attribute and a single value for
229
+ that attribute.
230
+
231
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/query.html)
232
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablequery-method)
233
+ """
234
+
235
+ def scan(self, **kwargs: Unpack[ScanInputTableScanTypeDef]) -> ScanOutputTableTypeDef:
236
+ """
237
+ The <code>Scan</code> operation returns one or more items and item attributes
238
+ by accessing every item in a table or a secondary index.
239
+
240
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/scan.html)
241
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablescan-method)
242
+ """
243
+
244
+ def update(self, **kwargs: Unpack[UpdateTableInputTableUpdateTypeDef]) -> _Table:
245
+ """
246
+ Modifies the provisioned throughput settings, global secondary indexes, or
247
+ DynamoDB Streams settings for a given table.
248
+
249
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/update.html)
250
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableupdate-method)
251
+ """
252
+
253
+ def update_item(
254
+ self, **kwargs: Unpack[UpdateItemInputTableUpdateItemTypeDef]
255
+ ) -> UpdateItemOutputTableTypeDef:
256
+ """
257
+ Edits an existing item's attributes, or adds a new item to the table if it does
258
+ not already exist.
259
+
260
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/update_item.html)
261
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableupdate_item-method)
262
+ """
263
+
264
+ def wait_until_exists(self) -> None:
265
+ """
266
+ Waits until Table is exists.
267
+
268
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/wait_until_exists.html)
269
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablewait_until_exists-method)
270
+ """
271
+
272
+ def wait_until_not_exists(self) -> None:
273
+ """
274
+ Waits until Table is not_exists.
275
+
276
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/wait_until_not_exists.html)
277
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablewait_until_not_exists-method)
278
+ """
279
+
280
+ def batch_writer(self, overwrite_by_pkeys: List[str] = ...) -> BatchWriter:
281
+ """
282
+ Create a batch writer object.
283
+
284
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/batch_writer.html)
285
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablebatch_writer-method)
286
+ """
287
+
288
+ def load(self) -> None:
289
+ """
290
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/load.html)
291
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tableload-method)
292
+ """
293
+
294
+ def reload(self) -> None:
295
+ """
296
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/reload.html)
297
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#tablereload-method)
298
+ """
299
+
300
+
301
+ _Table = Table
302
+
303
+
304
+ class DynamoDBResourceMeta(ResourceMeta):
305
+ client: DynamoDBClient # type: ignore[override]
306
+
307
+
308
+ class DynamoDBServiceResource(ServiceResource):
309
+ """
310
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/index.html)
311
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/)
312
+ """
313
+
314
+ meta: DynamoDBResourceMeta # type: ignore[override]
315
+ tables: ServiceResourceTablesCollection
316
+
317
+ def get_available_subresources(self) -> Sequence[str]:
318
+ """
319
+ Returns a list of all the available sub-resources for this resource.
320
+
321
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/get_available_subresources.html)
322
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourceget_available_subresources-method)
323
+ """
324
+
325
+ def batch_get_item(
326
+ self, **kwargs: Unpack[BatchGetItemInputServiceResourceBatchGetItemTypeDef]
327
+ ) -> BatchGetItemOutputServiceResourceTypeDef:
328
+ """
329
+ The <code>BatchGetItem</code> operation returns the attributes of one or more
330
+ items from one or more tables.
331
+
332
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/batch_get_item.html)
333
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourcebatch_get_item-method)
334
+ """
335
+
336
+ def batch_write_item(
337
+ self, **kwargs: Unpack[BatchWriteItemInputServiceResourceBatchWriteItemTypeDef]
338
+ ) -> BatchWriteItemOutputServiceResourceTypeDef:
339
+ """
340
+ The <code>BatchWriteItem</code> operation puts or deletes multiple items in one
341
+ or more tables.
342
+
343
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/batch_write_item.html)
344
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourcebatch_write_item-method)
345
+ """
346
+
347
+ def create_table(
348
+ self, **kwargs: Unpack[CreateTableInputServiceResourceCreateTableTypeDef]
349
+ ) -> _Table:
350
+ """
351
+ The <code>CreateTable</code> operation adds a new table to your account.
352
+
353
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/create_table.html)
354
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourcecreate_table-method)
355
+ """
356
+
357
+ def Table(self, name: str) -> _Table:
358
+ """
359
+ Creates a Table resource.
360
+
361
+ [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/Table.html)
362
+ [Show types-boto3 documentation](https://youtype.github.io/types_boto3_docs/types_boto3_dynamodb/service_resource/#dynamodbserviceresourcetable-method)
363
+ """