statikk 0.1.15__tar.gz → 0.1.17__tar.gz

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.
Files changed (43) hide show
  1. {statikk-0.1.15 → statikk-0.1.17}/PKG-INFO +1 -1
  2. {statikk-0.1.15 → statikk-0.1.17}/src/statikk/engine.py +5 -3
  3. {statikk-0.1.15 → statikk-0.1.17}/src/statikk/models.py +2 -3
  4. {statikk-0.1.15 → statikk-0.1.17}/src/statikk.egg-info/PKG-INFO +1 -1
  5. {statikk-0.1.15 → statikk-0.1.17}/tests/test_engine.py +6 -0
  6. {statikk-0.1.15 → statikk-0.1.17}/.coveragerc +0 -0
  7. {statikk-0.1.15 → statikk-0.1.17}/.gitignore +0 -0
  8. {statikk-0.1.15 → statikk-0.1.17}/.readthedocs.yml +0 -0
  9. {statikk-0.1.15 → statikk-0.1.17}/AUTHORS.rst +0 -0
  10. {statikk-0.1.15 → statikk-0.1.17}/CHANGELOG.rst +0 -0
  11. {statikk-0.1.15 → statikk-0.1.17}/CONTRIBUTING.rst +0 -0
  12. {statikk-0.1.15 → statikk-0.1.17}/LICENSE.txt +0 -0
  13. {statikk-0.1.15 → statikk-0.1.17}/README.rst +0 -0
  14. {statikk-0.1.15 → statikk-0.1.17}/assets/favicon.png +0 -0
  15. {statikk-0.1.15 → statikk-0.1.17}/assets/logo.png +0 -0
  16. {statikk-0.1.15 → statikk-0.1.17}/docs/Makefile +0 -0
  17. {statikk-0.1.15 → statikk-0.1.17}/docs/_static/.gitignore +0 -0
  18. {statikk-0.1.15 → statikk-0.1.17}/docs/authors.rst +0 -0
  19. {statikk-0.1.15 → statikk-0.1.17}/docs/changelog.rst +0 -0
  20. {statikk-0.1.15 → statikk-0.1.17}/docs/conf.py +0 -0
  21. {statikk-0.1.15 → statikk-0.1.17}/docs/contributing.rst +0 -0
  22. {statikk-0.1.15 → statikk-0.1.17}/docs/index.rst +0 -0
  23. {statikk-0.1.15 → statikk-0.1.17}/docs/license.rst +0 -0
  24. {statikk-0.1.15 → statikk-0.1.17}/docs/readme.rst +0 -0
  25. {statikk-0.1.15 → statikk-0.1.17}/docs/requirements.txt +0 -0
  26. {statikk-0.1.15 → statikk-0.1.17}/docs/usage.rst +0 -0
  27. {statikk-0.1.15 → statikk-0.1.17}/pyproject.toml +0 -0
  28. {statikk-0.1.15 → statikk-0.1.17}/setup.cfg +0 -0
  29. {statikk-0.1.15 → statikk-0.1.17}/setup.py +0 -0
  30. {statikk-0.1.15 → statikk-0.1.17}/src/statikk/__init__.py +0 -0
  31. {statikk-0.1.15 → statikk-0.1.17}/src/statikk/conditions.py +0 -0
  32. {statikk-0.1.15 → statikk-0.1.17}/src/statikk/expressions.py +0 -0
  33. {statikk-0.1.15 → statikk-0.1.17}/src/statikk/fields.py +0 -0
  34. {statikk-0.1.15 → statikk-0.1.17}/src/statikk/typing.py +0 -0
  35. {statikk-0.1.15 → statikk-0.1.17}/src/statikk.egg-info/SOURCES.txt +0 -0
  36. {statikk-0.1.15 → statikk-0.1.17}/src/statikk.egg-info/dependency_links.txt +0 -0
  37. {statikk-0.1.15 → statikk-0.1.17}/src/statikk.egg-info/not-zip-safe +0 -0
  38. {statikk-0.1.15 → statikk-0.1.17}/src/statikk.egg-info/requires.txt +0 -0
  39. {statikk-0.1.15 → statikk-0.1.17}/src/statikk.egg-info/top_level.txt +0 -0
  40. {statikk-0.1.15 → statikk-0.1.17}/tests/conftest.py +0 -0
  41. {statikk-0.1.15 → statikk-0.1.17}/tests/test_expressions.py +0 -0
  42. {statikk-0.1.15 → statikk-0.1.17}/tests/test_models.py +0 -0
  43. {statikk-0.1.15 → statikk-0.1.17}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statikk
3
- Version: 0.1.15
3
+ Version: 0.1.17
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
@@ -308,10 +308,11 @@ class Table:
308
308
  subtree_copy.set_parent_references(subtree_copy, force_override=True)
309
309
  subtree_copy._parent = new_parent
310
310
  subtree_copy._parent_field_name = field_name
311
- parent = subtree_copy._parent
311
+ parent = None
312
312
  for node in subtree_copy.dfs_traverse_hierarchy():
313
313
  self.build_model_indexes(node)
314
- setattr(node, FIELD_STATIKK_PARENT_ID, parent.id)
314
+ if parent:
315
+ setattr(node, FIELD_STATIKK_PARENT_ID, parent.id)
315
316
  parent = node
316
317
 
317
318
  return subtree_copy
@@ -431,7 +432,8 @@ class Table:
431
432
 
432
433
  reconstructed_dict.pop(FIELD_STATIKK_TYPE, None)
433
434
  model = model_class.model_validate(reconstructed_dict)
434
- model._is_persisted = True
435
+ for node in model.dfs_traverse_hierarchy():
436
+ node._is_persisted = True
435
437
  return model
436
438
 
437
439
  def scan(
@@ -211,6 +211,8 @@ class DatabaseModel(BaseModel, TrackingMixin):
211
211
  arbitrary_types_allowed = True
212
212
 
213
213
  def __eq__(self, other):
214
+ if other is None:
215
+ return False
214
216
  return self.id == other.id
215
217
 
216
218
  def is_parent_changed(self):
@@ -263,9 +265,6 @@ class DatabaseModel(BaseModel, TrackingMixin):
263
265
 
264
266
  @property
265
267
  def is_persisted(self) -> bool:
266
- if self._parent is not None:
267
- return self._parent.is_persisted
268
-
269
268
  return self._is_persisted
270
269
 
271
270
  @property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statikk
3
- Version: 0.1.15
3
+ Version: 0.1.17
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
@@ -1000,3 +1000,9 @@ def test_add_child_node():
1000
1000
  my_database_model = MyDatabaseModel.query_hierarchy(hash_key=Equals("foo"))
1001
1001
  assert len(my_database_model.nested.list_nested) == 1
1002
1002
  assert len(my_database_model.nested.other_list_nested) == 1
1003
+ hierarchy = MyDatabaseModel.query_hierarchy(hash_key=Equals("foo"))
1004
+ assert hierarchy.is_persisted is True
1005
+ assert hierarchy.nested.is_persisted is True
1006
+ assert hierarchy.nested.list_nested[0].is_persisted is True
1007
+ assert hierarchy.nested.other_list_nested[0].is_persisted is True
1008
+ assert hierarchy.nested.other_nested.is_persisted is True
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes