statikk 0.1.9__py3-none-any.whl → 0.1.11__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
@@ -306,16 +306,20 @@ class Table:
306
306
  subtree_copy.set_parent_references(subtree_copy, force_override=True)
307
307
  subtree_copy._parent = new_parent
308
308
  for node in subtree_copy.dfs_traverse_hierarchy():
309
- for idx in self.indexes:
310
- new_index_values = self._compose_index_values(node, idx)
311
- new_sort_key_value = new_index_values[idx.sort_key.name]
312
- setattr(node, idx.sort_key.name, new_sort_key_value)
313
- new_hash_key_value = new_index_values[idx.hash_key.name]
314
- setattr(node, idx.hash_key.name, new_hash_key_value)
309
+ self.build_model_indexes(node)
315
310
  setattr(node, FIELD_STATIKK_PARENT_ID, new_parent.id)
316
311
 
317
312
  return subtree_copy
318
313
 
314
+ def build_model_indexes(self, model: T) -> T:
315
+ for idx in self.indexes:
316
+ new_index_values = self._compose_index_values(model, idx)
317
+ new_sort_key_value = new_index_values[idx.sort_key.name]
318
+ setattr(model, idx.sort_key.name, new_sort_key_value)
319
+ new_hash_key_value = new_index_values[idx.hash_key.name]
320
+ setattr(model, idx.hash_key.name, new_hash_key_value)
321
+ return model
322
+
319
323
  def batch_write(self):
320
324
  """
321
325
  Returns a context manager for batch writing items to the database. This method handles all the buffering of the
statikk/models.py CHANGED
@@ -217,6 +217,10 @@ class DatabaseModel(BaseModel, TrackingMixin, extra=Extra.allow):
217
217
  current = current._parent
218
218
  return False
219
219
 
220
+ def build_model_indexes(self) -> T:
221
+ for node in self.dfs_traverse_hierarchy():
222
+ self._table.build_model_indexes(node)
223
+
220
224
  @classmethod
221
225
  def query(
222
226
  cls: Type[T],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: statikk
3
- Version: 0.1.9
3
+ Version: 0.1.11
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
@@ -0,0 +1,12 @@
1
+ statikk/__init__.py,sha256=pH5i4Fj1tbXLqLtTVIdoojiplZssQn0nnud8-HXodRE,577
2
+ statikk/conditions.py,sha256=63FYMR-UUaE-ZJEb_8CU721CQTwhajq39-BbokmKeMA,2166
3
+ statikk/engine.py,sha256=FB0eNNGE9ZHz43HbI0Op-7N2cY88Ec1-w68JkdHFDpE,33346
4
+ statikk/expressions.py,sha256=boAeGxZj2cDsXxoiX3IIEzfX9voSMQngi4-rE_jYeuE,12233
5
+ statikk/fields.py,sha256=LkMP5NnX7WS0HSLxI3Q-dMOrfaJ0SD7SayZxJU5Acgg,86
6
+ statikk/models.py,sha256=REipaPzo5dIq4InXbWuP48aDZdImO5fXGkALenbf7Ng,16257
7
+ statikk/typing.py,sha256=qfpegORcdODuILK3gvuD4SdcZA1a7Myn0yvscOLPHOM,68
8
+ statikk-0.1.11.dist-info/LICENSE.txt,sha256=uSH_2Hpb2Bigy5_HhBliN2fZbBU64G3ERM5zzhKPUEE,1078
9
+ statikk-0.1.11.dist-info/METADATA,sha256=eDwlysQ8a42xVr-zOFJHW8s9tcHM9Tqm_fOD_eWGanw,3161
10
+ statikk-0.1.11.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
11
+ statikk-0.1.11.dist-info/top_level.txt,sha256=etKmBbjzIlLpSefXoiOfhWGEgvqUEALaFwCjFDBD9YI,8
12
+ statikk-0.1.11.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (76.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- statikk/__init__.py,sha256=pH5i4Fj1tbXLqLtTVIdoojiplZssQn0nnud8-HXodRE,577
2
- statikk/conditions.py,sha256=63FYMR-UUaE-ZJEb_8CU721CQTwhajq39-BbokmKeMA,2166
3
- statikk/engine.py,sha256=0jF5pUZJtr_lBZMEZXd7PGDerr26CLZUh91gy15Leac,33252
4
- statikk/expressions.py,sha256=boAeGxZj2cDsXxoiX3IIEzfX9voSMQngi4-rE_jYeuE,12233
5
- statikk/fields.py,sha256=LkMP5NnX7WS0HSLxI3Q-dMOrfaJ0SD7SayZxJU5Acgg,86
6
- statikk/models.py,sha256=gzy_MV3LVsVlorqHencXyS7HCVV2QQ698aWK5bQIdFk,16115
7
- statikk/typing.py,sha256=qfpegORcdODuILK3gvuD4SdcZA1a7Myn0yvscOLPHOM,68
8
- statikk-0.1.9.dist-info/LICENSE.txt,sha256=uSH_2Hpb2Bigy5_HhBliN2fZbBU64G3ERM5zzhKPUEE,1078
9
- statikk-0.1.9.dist-info/METADATA,sha256=ZvTT-xMgID_v5WgHYz13E_JLHtqflVz9naDu9Qh-9rA,3160
10
- statikk-0.1.9.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
11
- statikk-0.1.9.dist-info/top_level.txt,sha256=etKmBbjzIlLpSefXoiOfhWGEgvqUEALaFwCjFDBD9YI,8
12
- statikk-0.1.9.dist-info/RECORD,,