boto3-assist 0.1.1__py3-none-any.whl → 0.1.2__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_index.py +18 -6
- boto3_assist/dynamodb/dynamodb_key.py +3 -2
- boto3_assist/version.py +1 -1
- {boto3_assist-0.1.1.dist-info → boto3_assist-0.1.2.dist-info}/METADATA +1 -1
- {boto3_assist-0.1.1.dist-info → boto3_assist-0.1.2.dist-info}/RECORD +8 -8
- {boto3_assist-0.1.1.dist-info → boto3_assist-0.1.2.dist-info}/WHEEL +0 -0
- {boto3_assist-0.1.1.dist-info → boto3_assist-0.1.2.dist-info}/licenses/LICENSE-EXPLAINED.txt +0 -0
- {boto3_assist-0.1.1.dist-info → boto3_assist-0.1.2.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -6,7 +6,7 @@ https://github.com/geekcafe/boto3-assist
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
|
-
from typing import Optional
|
|
9
|
+
from typing import Optional, Any
|
|
10
10
|
from boto3.dynamodb.conditions import (
|
|
11
11
|
ConditionBase,
|
|
12
12
|
Key,
|
|
@@ -110,7 +110,8 @@ class DynamoDBIndex:
|
|
|
110
110
|
*,
|
|
111
111
|
include_sort_key: bool = True,
|
|
112
112
|
condition: str = "begins_with",
|
|
113
|
-
|
|
113
|
+
low_value: Any = None,
|
|
114
|
+
high_value: Any = None,
|
|
114
115
|
# sk_value_2: Optional[str | int | float] = None,
|
|
115
116
|
) -> dict | Key | ConditionBase | ComparisonCondition | Equals:
|
|
116
117
|
"""Get the key for a given index"""
|
|
@@ -129,6 +130,7 @@ class DynamoDBIndex:
|
|
|
129
130
|
key = self._build_query_key(
|
|
130
131
|
include_sort_key=include_sort_key,
|
|
131
132
|
condition=condition,
|
|
133
|
+
low_value=low_value,
|
|
132
134
|
high_value=high_value,
|
|
133
135
|
)
|
|
134
136
|
return key
|
|
@@ -138,7 +140,8 @@ class DynamoDBIndex:
|
|
|
138
140
|
*,
|
|
139
141
|
include_sort_key: bool = True,
|
|
140
142
|
condition: str = "begins_with",
|
|
141
|
-
|
|
143
|
+
low_value: Any = None,
|
|
144
|
+
high_value: Any = None,
|
|
142
145
|
) -> And | Equals:
|
|
143
146
|
"""Get the GSI index name and key"""
|
|
144
147
|
|
|
@@ -146,13 +149,22 @@ class DynamoDBIndex:
|
|
|
146
149
|
self.partition_key.value
|
|
147
150
|
)
|
|
148
151
|
|
|
149
|
-
if
|
|
152
|
+
if (
|
|
153
|
+
include_sort_key
|
|
154
|
+
and self.sort_key.attribute_name
|
|
155
|
+
and (
|
|
156
|
+
self.sort_key.value
|
|
157
|
+
or (low_value is not None and high_value is not None)
|
|
158
|
+
)
|
|
159
|
+
):
|
|
150
160
|
# if self.sk_value_2:
|
|
151
|
-
if high_value:
|
|
161
|
+
if low_value is not None and high_value is not None:
|
|
152
162
|
match condition:
|
|
153
163
|
case "between":
|
|
164
|
+
low = f"{self.sort_key.value}{low_value}"
|
|
165
|
+
high = f"{self.sort_key.value}{high_value}"
|
|
154
166
|
key = key & Key(f"{self.sort_key.attribute_name}").between(
|
|
155
|
-
|
|
167
|
+
low, high
|
|
156
168
|
)
|
|
157
169
|
|
|
158
170
|
else:
|
|
@@ -53,9 +53,10 @@ class DynamoDBKey:
|
|
|
53
53
|
"""
|
|
54
54
|
parts = []
|
|
55
55
|
for key, value in key_value_pairs:
|
|
56
|
+
prefix = f"{key}#" if key else ""
|
|
56
57
|
if value is None:
|
|
57
|
-
parts.append(f"{
|
|
58
|
+
parts.append(f"{prefix}")
|
|
58
59
|
break
|
|
59
60
|
else:
|
|
60
|
-
parts.append(f"{
|
|
61
|
+
parts.append(f"{prefix}{value}")
|
|
61
62
|
return "#".join(parts)
|
boto3_assist/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.1.
|
|
1
|
+
__version__ = '0.1.2'
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
boto3_assist/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
boto3_assist/boto3session.py,sha256=J20E2lkqJOaey4Ohi-xRe2xABj7QsA8DrggzK29-5es,6415
|
|
3
|
-
boto3_assist/version.py,sha256=
|
|
3
|
+
boto3_assist/version.py,sha256=mdp2CftfqYbdKtP-eWv1z7rAUycYv6X1ntXSMUf8Kss,22
|
|
4
4
|
boto3_assist/dynamodb/dynamodb.py,sha256=jU4R__5jjI1CmH9xVNUeU8PICD2dtbQ2CYUFKMRw0P0,14561
|
|
5
5
|
boto3_assist/dynamodb/dynamodb_connection.py,sha256=JMCmWOsMzy45rikGl3Z2xqlG2vUTEKSYqi6dpsfJ750,4418
|
|
6
6
|
boto3_assist/dynamodb/dynamodb_connection_tracker.py,sha256=nTNQ99sIidDoLMhMbBju2umgLmcttsmnvmd_DMy_J9M,1582
|
|
7
7
|
boto3_assist/dynamodb/dynamodb_helpers.py,sha256=ajpTJ5bJOm9PDgE2Zx9p2zkTRFV4xswqJRS81SOTn1s,12198
|
|
8
8
|
boto3_assist/dynamodb/dynamodb_importer.py,sha256=8SlT2W03Dvb3LIs6xqtzXP4IShyv655PgMCDNr4kmPk,2559
|
|
9
|
-
boto3_assist/dynamodb/dynamodb_index.py,sha256=
|
|
9
|
+
boto3_assist/dynamodb/dynamodb_index.py,sha256=LRQgSci222s-pU-JXgnaAoOa71ABX9h3uJPeCVPl1GE,6315
|
|
10
10
|
boto3_assist/dynamodb/dynamodb_iservice.py,sha256=2AuaKxt7DUZbB-GpBBtPtPMpAlgZkumkAldm8vy7-sg,701
|
|
11
|
-
boto3_assist/dynamodb/dynamodb_key.py,sha256=
|
|
11
|
+
boto3_assist/dynamodb/dynamodb_key.py,sha256=X3I3gUPx2T858vjRDi9SN8qn8ez5UJUo0vZiKBeeUWg,1776
|
|
12
12
|
boto3_assist/dynamodb/dynamodb_model_base.py,sha256=B8E4D2btjcIJjpzDnULlQk5Ccp5Qp3vN8vRdUHlshns,10949
|
|
13
13
|
boto3_assist/dynamodb/dynamodb_model_base_interfaces.py,sha256=yT4zDRI8vP15WVOHnCvY3FsEy_QSIta5-bnUby70Xow,747
|
|
14
14
|
boto3_assist/dynamodb/dynamodb_reindexer.py,sha256=_I-W7Ply-82fRHnhsRZuquRYxEIXubuWGq7E7B4Pa7I,6204
|
|
@@ -21,8 +21,8 @@ boto3_assist/utilities/datetime_utility.py,sha256=TbqGQkJDTahqvaZAIV550nhYnW1Bsq
|
|
|
21
21
|
boto3_assist/utilities/logging_utility.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
boto3_assist/utilities/serialization_utility.py,sha256=s_QQRIhtwIE7xN5nU13mNk2wtWyErBX_Sg7n0gbHj-M,4308
|
|
23
23
|
boto3_assist/utilities/string_utility.py,sha256=w8l063UT3GE48tuJopETyZrjG4CgAzWkyDWMAYMg5Og,7432
|
|
24
|
-
boto3_assist-0.1.
|
|
25
|
-
boto3_assist-0.1.
|
|
26
|
-
boto3_assist-0.1.
|
|
27
|
-
boto3_assist-0.1.
|
|
28
|
-
boto3_assist-0.1.
|
|
24
|
+
boto3_assist-0.1.2.dist-info/METADATA,sha256=m3h0jNmaoYo8ji85NGE8Bm5s6nss7Z8CsqyJMmBsf78,1804
|
|
25
|
+
boto3_assist-0.1.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
26
|
+
boto3_assist-0.1.2.dist-info/licenses/LICENSE-EXPLAINED.txt,sha256=WFREvTpfTjPjDHpOLADxJpCKpIla3Ht87RUUGii4ODU,606
|
|
27
|
+
boto3_assist-0.1.2.dist-info/licenses/LICENSE.txt,sha256=PXDhFWS5L5aOTkVhNvoitHKbAkgxqMI2uUPQyrnXGiI,1105
|
|
28
|
+
boto3_assist-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
{boto3_assist-0.1.1.dist-info → boto3_assist-0.1.2.dist-info}/licenses/LICENSE-EXPLAINED.txt
RENAMED
|
File without changes
|
|
File without changes
|