statikk 0.0.10__py3-none-any.whl → 0.0.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
@@ -19,6 +19,10 @@ from statikk.models import (
19
19
  KeySchema,
20
20
  )
21
21
 
22
+ from aws_xray_sdk.core import xray_recorder
23
+ from aws_xray_sdk.core import patch_all
24
+
25
+ patch_all()
22
26
 
23
27
  class InvalidIndexNameError(Exception):
24
28
  pass
@@ -54,19 +58,30 @@ class Table:
54
58
  model.set_table_ref(self)
55
59
  if "type" not in model.model_fields:
56
60
  model.model_fields["type"] = FieldInfo(annotation=str, default=model.model_type(), required=False)
61
+ self._client = None
62
+ self._dynamodb_table = None
57
63
 
58
64
  def _dynamodb_client(self):
59
- return boto3.client(
65
+ if self._client:
66
+ return self._client
67
+
68
+ self._client = boto3.client(
60
69
  "dynamodb",
61
70
  config=Config(region_name=os.environ.get("AWS_DEFAULT_REGION", "eu-west-1")),
62
71
  )
63
72
 
73
+ return self._client
74
+
64
75
  def _get_dynamodb_table(self):
76
+ if self._dynamodb_table:
77
+ return self._dynamodb_table
78
+
65
79
  dynamodb = boto3.resource(
66
80
  "dynamodb",
67
81
  config=Config(region_name=os.environ.get("AWS_DEFAULT_REGION", "eu-west-1")),
68
82
  )
69
- return dynamodb.Table(self.name)
83
+ self._dynamodb_table = dynamodb.Table(self.name)
84
+ return self._dynamodb_table
70
85
 
71
86
  def _to_dynamodb_type(self, type: Any):
72
87
  if type is str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: statikk
3
- Version: 0.0.10
3
+ Version: 0.0.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
@@ -13,8 +13,9 @@ 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.3.0
16
+ Requires-Dist: pydantic ==2.7.4
17
17
  Requires-Dist: boto3 ==1.28.43
18
+ Requires-Dist: aws-xray-sdk ==2.14.0
18
19
  Requires-Dist: importlib-metadata ; python_version < "3.8"
19
20
  Provides-Extra: testing
20
21
  Requires-Dist: setuptools ; extra == 'testing'
@@ -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=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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.43.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=7X4iAci6UBzpMkYtjS_da-iwNzf4zPbwkXvJ290IIdU,21767
4
- statikk/expressions.py,sha256=mF6Hmj3Kmj6KKXTymeTHSepVA7rhiSINpFgSAPeBTRY,12210
5
- statikk/models.py,sha256=q-wY2bQRgaH0NTnR4NGnQ22eO3rUshK-aAykt7NVFO4,6172
6
- statikk-0.0.10.dist-info/LICENSE.txt,sha256=uSH_2Hpb2Bigy5_HhBliN2fZbBU64G3ERM5zzhKPUEE,1078
7
- statikk-0.0.10.dist-info/METADATA,sha256=9miP26eX1SuDKFVoQNm7W-2j-ZCEFyLwheAQ8quO214,3293
8
- statikk-0.0.10.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
9
- statikk-0.0.10.dist-info/top_level.txt,sha256=etKmBbjzIlLpSefXoiOfhWGEgvqUEALaFwCjFDBD9YI,8
10
- statikk-0.0.10.dist-info/RECORD,,