statikk 0.0.11__py3-none-any.whl → 0.0.13__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.
statikk/engine.py CHANGED
@@ -164,14 +164,6 @@ class Table:
164
164
  """Deletes the DynamoDB table."""
165
165
  self._dynamodb_client().delete_table(TableName=self.name)
166
166
 
167
- def delete_item(self, id: str):
168
- """
169
- Deletes an item from the database by id, using the partition key of the table.
170
- :param id: The id of the item to delete.
171
- """
172
- key = {self.key_schema.hash_key: id}
173
- self._get_dynamodb_table().delete_item(Key=key)
174
-
175
167
  def get_item(
176
168
  self,
177
169
  id: str,
@@ -196,6 +188,14 @@ class Table:
196
188
  data[key] = self._deserialize_value(value, model_class.model_fields[key])
197
189
  return model_class(**data)
198
190
 
191
+ def delete_item(self, id: str):
192
+ """
193
+ Deletes an item from the database by id, using the partition key of the table.
194
+ :param id: The id of the item to delete.
195
+ """
196
+ key = {self.key_schema.hash_key: id}
197
+ self._get_dynamodb_table().delete_item(Key=key)
198
+
199
199
  def put_item(self, model: DatabaseModel) -> DatabaseModel:
200
200
  """
201
201
  Puts an item into the database.
@@ -389,7 +389,7 @@ class Table:
389
389
  else:
390
390
  results.extend(
391
391
  [
392
- model_class(**self._convert_dynamodb_to_python(item))
392
+ self._deserialize_item(self._convert_dynamodb_to_python(item), model_class)
393
393
  for item in response["Responses"][self.name]
394
394
  ]
395
395
  )
@@ -425,7 +425,7 @@ class Table:
425
425
  return model_class(**item)
426
426
 
427
427
  def _deserialize_value(self, value: Any, annotation: Any):
428
- if annotation is datetime or "datetime" in str(annotation):
428
+ if annotation is datetime or "datetime" in str(annotation) and value is not None:
429
429
  return datetime.fromtimestamp(int(value))
430
430
  if annotation is float:
431
431
  return float(value)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: statikk
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: statikk is a single table application (STA) library for DynamoDb.
5
5
  Home-page: https://github.com/terinia/statikk
6
6
  Author: Balint Biro
@@ -13,15 +13,15 @@ Classifier: Programming Language :: Python
13
13
  Requires-Python: >=3.8
14
14
  Description-Content-Type: text/x-rst; charset=UTF-8
15
15
  License-File: LICENSE.txt
16
- Requires-Dist: pydantic ==2.7.4
17
- Requires-Dist: boto3 ==1.28.43
18
- Requires-Dist: aws-xray-sdk ==2.14.0
19
- Requires-Dist: importlib-metadata ; python_version < "3.8"
16
+ Requires-Dist: importlib-metadata; python_version < "3.8"
17
+ Requires-Dist: pydantic<3.0,>=2.7.4
18
+ Requires-Dist: boto3<2.0,>=1.28.43
19
+ Requires-Dist: aws-xray-sdk<3.0,>=2.14.0
20
20
  Provides-Extra: testing
21
- Requires-Dist: setuptools ; extra == 'testing'
22
- Requires-Dist: pytest ; extra == 'testing'
23
- Requires-Dist: pytest-cov ; extra == 'testing'
24
- Requires-Dist: moto[dynamodb] ; extra == 'testing'
21
+ Requires-Dist: setuptools; extra == "testing"
22
+ Requires-Dist: pytest; extra == "testing"
23
+ Requires-Dist: pytest-cov; extra == "testing"
24
+ Requires-Dist: moto[dynamodb]==4.2.14; extra == "testing"
25
25
 
26
26
  .. image:: ./assets/logo.png
27
27
  :alt: Statikk
@@ -0,0 +1,10 @@
1
+ statikk/__init__.py,sha256=pH5i4Fj1tbXLqLtTVIdoojiplZssQn0nnud8-HXodRE,577
2
+ statikk/conditions.py,sha256=66kJ-2YWqlV-dzEkiAe6c985dMQ-lpaoZ8aaoWhSs_M,2220
3
+ statikk/engine.py,sha256=aYIVTwUxlSLnoB8DOUpX4udf0PcIoiTzgSfJ3YCtPaU,22193
4
+ statikk/expressions.py,sha256=mF6Hmj3Kmj6KKXTymeTHSepVA7rhiSINpFgSAPeBTRY,12210
5
+ statikk/models.py,sha256=q-wY2bQRgaH0NTnR4NGnQ22eO3rUshK-aAykt7NVFO4,6172
6
+ statikk-0.0.13.dist-info/LICENSE.txt,sha256=uSH_2Hpb2Bigy5_HhBliN2fZbBU64G3ERM5zzhKPUEE,1078
7
+ statikk-0.0.13.dist-info/METADATA,sha256=oJ8DfNGW9YKONAJKqq48r02v5WFlOQi75lV63HBJavI,3345
8
+ statikk-0.0.13.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
9
+ statikk-0.0.13.dist-info/top_level.txt,sha256=etKmBbjzIlLpSefXoiOfhWGEgvqUEALaFwCjFDBD9YI,8
10
+ statikk-0.0.13.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- statikk/__init__.py,sha256=pH5i4Fj1tbXLqLtTVIdoojiplZssQn0nnud8-HXodRE,577
2
- statikk/conditions.py,sha256=66kJ-2YWqlV-dzEkiAe6c985dMQ-lpaoZ8aaoWhSs_M,2220
3
- statikk/engine.py,sha256=wjorLdbirezwymmqyEgSdAVrJCizQZW6RSn00eXsvvY,22149
4
- statikk/expressions.py,sha256=mF6Hmj3Kmj6KKXTymeTHSepVA7rhiSINpFgSAPeBTRY,12210
5
- statikk/models.py,sha256=q-wY2bQRgaH0NTnR4NGnQ22eO3rUshK-aAykt7NVFO4,6172
6
- statikk-0.0.11.dist-info/LICENSE.txt,sha256=uSH_2Hpb2Bigy5_HhBliN2fZbBU64G3ERM5zzhKPUEE,1078
7
- statikk-0.0.11.dist-info/METADATA,sha256=wzxKaL43IN7GtHmpfU-7cHuuTW-Jr2PGO7SOh1fV014,3330
8
- statikk-0.0.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
9
- statikk-0.0.11.dist-info/top_level.txt,sha256=etKmBbjzIlLpSefXoiOfhWGEgvqUEALaFwCjFDBD9YI,8
10
- statikk-0.0.11.dist-info/RECORD,,