boto3-assist 0.22.0__py3-none-any.whl → 0.23.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.
- boto3_assist/dynamodb/dynamodb.py +3 -1
- boto3_assist/dynamodb/dynamodb_index.py +10 -5
- boto3_assist/dynamodb/dynamodb_model_base.py +9 -1
- boto3_assist/version.py +1 -1
- {boto3_assist-0.22.0.dist-info → boto3_assist-0.23.0.dist-info}/METADATA +1 -1
- {boto3_assist-0.22.0.dist-info → boto3_assist-0.23.0.dist-info}/RECORD +9 -9
- {boto3_assist-0.22.0.dist-info → boto3_assist-0.23.0.dist-info}/WHEEL +0 -0
- {boto3_assist-0.22.0.dist-info → boto3_assist-0.23.0.dist-info}/licenses/LICENSE-EXPLAINED.txt +0 -0
- {boto3_assist-0.22.0.dist-info → boto3_assist-0.23.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -355,7 +355,9 @@ class DynamoDB(DynamoDBConnection):
|
|
|
355
355
|
key = key.key()
|
|
356
356
|
|
|
357
357
|
kwargs: dict = {}
|
|
358
|
-
|
|
358
|
+
|
|
359
|
+
if index_name and index_name != "primary":
|
|
360
|
+
# only include the index_name if we are not using our "primary" pk/sk
|
|
359
361
|
kwargs["IndexName"] = f"{index_name}"
|
|
360
362
|
kwargs["TableName"] = f"{table_name}"
|
|
361
363
|
kwargs["KeyConditionExpression"] = key
|
|
@@ -37,7 +37,7 @@ class DynamoDBIndexes:
|
|
|
37
37
|
if index.name in self.__indexes:
|
|
38
38
|
raise ValueError(
|
|
39
39
|
f"The index {index.name} is already defined in your model somewhere. "
|
|
40
|
-
"This error is generated to protect you from
|
|
40
|
+
"This error is generated to protect you from unforeseen issues. "
|
|
41
41
|
"If you models are inheriting from other models, you may have the primary defined twice."
|
|
42
42
|
)
|
|
43
43
|
|
|
@@ -64,7 +64,7 @@ class DynamoDBIndexes:
|
|
|
64
64
|
for _, v in self.__indexes.items():
|
|
65
65
|
if v.partition_key.attribute_name == index.partition_key.attribute_name:
|
|
66
66
|
raise ValueError(
|
|
67
|
-
f"The
|
|
67
|
+
f"The attribute {index.partition_key.attribute_name} is already being used by index "
|
|
68
68
|
f"{v.name}. "
|
|
69
69
|
f"Reusing this attribute would over write the value on index {v.name}"
|
|
70
70
|
)
|
|
@@ -73,7 +73,7 @@ class DynamoDBIndexes:
|
|
|
73
73
|
for _, v in self.__indexes.items():
|
|
74
74
|
if v.sort_key.attribute_name == index.sort_key.attribute_name:
|
|
75
75
|
raise ValueError(
|
|
76
|
-
f"The
|
|
76
|
+
f"The attribute {index.sort_key.attribute_name} is already being used by index "
|
|
77
77
|
f"{v.name}. "
|
|
78
78
|
f"Reusing this attribute would over write the value on index {v.name}"
|
|
79
79
|
)
|
|
@@ -160,9 +160,14 @@ class DynamoDBIndex:
|
|
|
160
160
|
) -> dict | Key | ConditionBase | ComparisonCondition | Equals:
|
|
161
161
|
"""Get the key for a given index"""
|
|
162
162
|
key: dict | Key | ConditionBase | ComparisonCondition | Equals
|
|
163
|
-
if
|
|
163
|
+
if (
|
|
164
|
+
self.name == DynamoDBIndexes.PRIMARY_INDEX
|
|
165
|
+
and include_sort_key
|
|
166
|
+
# if it ends with a # we are assuming that we are doing a wild card mapping
|
|
167
|
+
and not str(self.sort_key.value).endswith("#")
|
|
168
|
+
):
|
|
164
169
|
# this is a direct primary key which is used in a get call
|
|
165
|
-
# this is
|
|
170
|
+
# this is different than query keys
|
|
166
171
|
key = {}
|
|
167
172
|
key[self.partition_key.attribute_name] = self.partition_key.value
|
|
168
173
|
|
|
@@ -21,6 +21,7 @@ from boto3_assist.dynamodb.dynamodb_index import (
|
|
|
21
21
|
from boto3_assist.dynamodb.dynamodb_reserved_words import DynamoDBReservedWords
|
|
22
22
|
from boto3_assist.utilities.datetime_utility import DatetimeUtility
|
|
23
23
|
from boto3_assist.models.serializable_model import SerializableModel
|
|
24
|
+
from boto3_assist.utilities.string_utility import StringUtility
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
def exclude_from_serialization(method):
|
|
@@ -190,7 +191,7 @@ class DynamoDBModelBase(SerializableModel):
|
|
|
190
191
|
def to_dictionary(self, include_none: bool = True):
|
|
191
192
|
"""
|
|
192
193
|
Convert the instance to a dictionary without an indexes/keys.
|
|
193
|
-
|
|
194
|
+
Useful for turning an object into a dictionary for serialization.
|
|
194
195
|
This is the same as to_resource_dictionary(include_indexes=False)
|
|
195
196
|
"""
|
|
196
197
|
return DynamoDBSerializer.to_resource_dictionary(
|
|
@@ -205,6 +206,13 @@ class DynamoDBModelBase(SerializableModel):
|
|
|
205
206
|
|
|
206
207
|
return self.indexes.get(index_name)
|
|
207
208
|
|
|
209
|
+
@staticmethod
|
|
210
|
+
def generate_uuid(sortable: bool = True) -> str:
|
|
211
|
+
if sortable:
|
|
212
|
+
return StringUtility.generate_sortable_uuid()
|
|
213
|
+
|
|
214
|
+
return StringUtility.generate_uuid()
|
|
215
|
+
|
|
208
216
|
@property
|
|
209
217
|
@exclude_from_serialization
|
|
210
218
|
def helpers(self) -> DynamoDBHelpers:
|
boto3_assist/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.
|
|
1
|
+
__version__ = '0.23.0'
|
|
@@ -6,7 +6,7 @@ boto3_assist/connection_tracker.py,sha256=UgfR9RlvXf3A4ssMr3gDMpw89ka8mSRvJn4M34
|
|
|
6
6
|
boto3_assist/http_status_codes.py,sha256=G0zRSWenwavYKETvDF9tNVUXQz3Ae2gXdBETYbjvJe8,3284
|
|
7
7
|
boto3_assist/role_assumption_mixin.py,sha256=PMUU5yC2FUBjFD1UokVkRY3CPB5zTw85AhIB5BMtbc8,1031
|
|
8
8
|
boto3_assist/session_setup_mixin.py,sha256=X-JQKyyaWNA8Z8kKgf2V2I5vsiLAH8udLTX_xepnsdQ,3140
|
|
9
|
-
boto3_assist/version.py,sha256=
|
|
9
|
+
boto3_assist/version.py,sha256=pwluWaTPL8Xkb9G3PEN8_juXZgyuXodBFmQvwlw9pb4,23
|
|
10
10
|
boto3_assist/aws_lambda/event_info.py,sha256=OkZ4WzuGaHEu_T8sB188KBgShAJhZpWASALKRGBOhMg,14648
|
|
11
11
|
boto3_assist/aws_lambda/mock_context.py,sha256=LPjHP-3YSoY6iPl1kPqJDwSVf1zLNTcukUunDtYcbK0,116
|
|
12
12
|
boto3_assist/cloudwatch/cloudwatch_connection.py,sha256=mnGWaLSQpHh5EeY7Ek_2o9JKHJxOELIYtQVMX1IaHn4,2480
|
|
@@ -19,14 +19,14 @@ boto3_assist/cognito/cognito_connection.py,sha256=deuXR3cNHz0mCYff2k0LfAvK--9Okq
|
|
|
19
19
|
boto3_assist/cognito/cognito_utility.py,sha256=IVZAg58nHG1U7uxe7FsTYpqwwZiwwdIBGiVTZuLCFqg,18417
|
|
20
20
|
boto3_assist/cognito/jwks_cache.py,sha256=1Y9r-YfQ8qrgZN5xYPvjUEEV0vthbdcPdAIaPbZP7kU,373
|
|
21
21
|
boto3_assist/cognito/user.py,sha256=qc44qLx3gwq6q2zMxcPQze1EjeZwy5Kuav93vbe-4WU,820
|
|
22
|
-
boto3_assist/dynamodb/dynamodb.py,sha256=
|
|
22
|
+
boto3_assist/dynamodb/dynamodb.py,sha256=aW6kWq-Hcc6idmuFygdpUyPusPHsIvVGq2hiG8n8gBo,18481
|
|
23
23
|
boto3_assist/dynamodb/dynamodb_connection.py,sha256=D4KmVpMpE0OuVOwW5g4JBWllUNkwy0hMXEGUiToAMBc,3608
|
|
24
24
|
boto3_assist/dynamodb/dynamodb_helpers.py,sha256=RoRRqKjdwfC-2-gvlkLvCoNWhIoMrHm-68dkyhXI_Xk,12080
|
|
25
25
|
boto3_assist/dynamodb/dynamodb_importer.py,sha256=nCKsyRQeMqDSf0Q5mQ_X_oVIg4PRnu0hcUzZnBli610,3471
|
|
26
|
-
boto3_assist/dynamodb/dynamodb_index.py,sha256=
|
|
26
|
+
boto3_assist/dynamodb/dynamodb_index.py,sha256=AOIeiWkJ3dgg21PJ2vADkR61l1AA6z5IYV3WtPYlvng,8734
|
|
27
27
|
boto3_assist/dynamodb/dynamodb_iservice.py,sha256=O9Aj0PFEvcuk2vhARifWTFnUwcQW5EXzwZS478Hm-N0,796
|
|
28
28
|
boto3_assist/dynamodb/dynamodb_key.py,sha256=4IYnG4a99AjdOKUcDaWhNF_lvZJRZcKOIPzBQQzVdB0,3294
|
|
29
|
-
boto3_assist/dynamodb/dynamodb_model_base.py,sha256=
|
|
29
|
+
boto3_assist/dynamodb/dynamodb_model_base.py,sha256=Bgnjs62lHTqqJ2nZbPV1JHvcK6d2-aaRsJtcc8DEqKk,12291
|
|
30
30
|
boto3_assist/dynamodb/dynamodb_model_base_interfaces.py,sha256=SFw-yK7TDPL4cK52bpn2zMm5G4mX7eYNU7eFytEw0-A,749
|
|
31
31
|
boto3_assist/dynamodb/dynamodb_re_indexer.py,sha256=Y0qRrvpmjS68w8ci6Au7Hg02W_ktqhUGGALeN-9XTls,6164
|
|
32
32
|
boto3_assist/dynamodb/dynamodb_reindexer.py,sha256=bCj6KIU0fQOgjkkiq9yF51PFZZr4Y9Lu3-hPlmsPG0Y,6164
|
|
@@ -57,8 +57,8 @@ boto3_assist/utilities/logging_utility.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
57
57
|
boto3_assist/utilities/numbers_utility.py,sha256=wzv9d0uXT_2_ZHHio7LBzibwxPqhGpvbq9HinrVn_4A,10160
|
|
58
58
|
boto3_assist/utilities/serialization_utility.py,sha256=Jc6H0cpcZjLO7tdyUZdBWHzItduLkw6sh2YQh8Hc8D8,21647
|
|
59
59
|
boto3_assist/utilities/string_utility.py,sha256=XxUIz19L2LFFTRDAAmdPa8Qhn40u9yO7g4nULFuvg0M,11033
|
|
60
|
-
boto3_assist-0.
|
|
61
|
-
boto3_assist-0.
|
|
62
|
-
boto3_assist-0.
|
|
63
|
-
boto3_assist-0.
|
|
64
|
-
boto3_assist-0.
|
|
60
|
+
boto3_assist-0.23.0.dist-info/METADATA,sha256=3Qv_kRRHYWhDr-E5jQG7qH7Y1lFy6-6qAIA8hALdMJI,2875
|
|
61
|
+
boto3_assist-0.23.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
62
|
+
boto3_assist-0.23.0.dist-info/licenses/LICENSE-EXPLAINED.txt,sha256=WFREvTpfTjPjDHpOLADxJpCKpIla3Ht87RUUGii4ODU,606
|
|
63
|
+
boto3_assist-0.23.0.dist-info/licenses/LICENSE.txt,sha256=PXDhFWS5L5aOTkVhNvoitHKbAkgxqMI2uUPQyrnXGiI,1105
|
|
64
|
+
boto3_assist-0.23.0.dist-info/RECORD,,
|
|
File without changes
|
{boto3_assist-0.22.0.dist-info → boto3_assist-0.23.0.dist-info}/licenses/LICENSE-EXPLAINED.txt
RENAMED
|
File without changes
|
|
File without changes
|