python-general-be-lib 0.11.0__py3-none-any.whl → 0.11.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.
@@ -31,6 +31,11 @@ class Base:
31
31
  or nothing: passing ``__config__`` puts the whole configuration in the hands of the
32
32
  caller, and passing ``__base__`` lets the base carry its own.
33
33
 
34
+ The generated class is stamped with the module of the entity, unless the caller
35
+ passes ``__module__``: ``create_model`` reads the calling frame otherwise, so every
36
+ generated model would claim to live in this module and a ``repr`` would point at
37
+ the library instead of the entity.
38
+
34
39
  Args:
35
40
  model_name (str, optional): Name of the generated model. When not given,
36
41
  ``{ClassName}Model`` is used.
@@ -49,6 +54,8 @@ class Base:
49
54
  Returns:
50
55
  Type[BaseModel]: Dynamically generated Pydantic class.
51
56
  """
57
+ create_model_kwargs.setdefault("__module__", cls.__module__)
58
+
52
59
  if "__config__" not in create_model_kwargs.keys() and "__base__" not in create_model_kwargs.keys():
53
60
  create_model_kwargs["__config__"] = ConfigDict(from_attributes=True, populate_by_name=True, arbitrary_types_allowed=True, validate_default=True)
54
61
 
@@ -342,7 +342,7 @@ class CrudMetadata:
342
342
  if rows:
343
343
  return rows[0]
344
344
  if strict:
345
- raise EntityNotFoundException()
345
+ raise EntityNotFoundException(custom_message=table.name)
346
346
  return None
347
347
 
348
348
  def _get(self, table: Table, connection: Connection, pk: Any, columns: list[str] = None, **kwhere):
@@ -429,7 +429,7 @@ class CrudMetadata:
429
429
  if rows:
430
430
  return rows[0]
431
431
  if strict:
432
- raise EntityNotFoundException()
432
+ raise EntityNotFoundException(custom_message=table.name)
433
433
  return None
434
434
 
435
435
  def insert(self, from_table: str, connection: Connection = None, models: list[Type[BaseModel] | BaseModel] = None, values: list[dict[str, Any]] = None, returning: bool = True,
@@ -423,7 +423,7 @@ class CrudRepository[Entity: Base | Type[Base]]:
423
423
  if records:
424
424
  return records[0]
425
425
  if strict:
426
- raise EntityNotFoundException()
426
+ raise EntityNotFoundException(custom_message=self.entity.__name__)
427
427
  return None
428
428
 
429
429
  def _get(self, session: Session, pk: Any, columns: list[str] = None, exclude_columns: list[str] = None, **kwhere):
@@ -523,7 +523,7 @@ class CrudRepository[Entity: Base | Type[Base]]:
523
523
  if records:
524
524
  return records[0]
525
525
  if strict:
526
- raise EntityNotFoundException()
526
+ raise EntityNotFoundException(custom_message=self.entity.__name__)
527
527
  return None
528
528
 
529
529
  def _find(self, session: Session, where: dict[str, Any] = None, columns: list[str] = None, exclude_columns: list[str] = None, limit: int = 0, orders_by: dict[str, bool] = None, **kwhere):
@@ -0,0 +1,3 @@
1
+ from .consts import *
2
+
3
+ __all__ = ["ENGINE_DEFAULTS", "ENGINE_DEFAULTS_QUEUE_POOL", "SESSION_DEFAULTS"]
@@ -0,0 +1,6 @@
1
+ __all__ = ["ENGINE_DEFAULTS", "ENGINE_DEFAULTS_QUEUE_POOL", "SESSION_DEFAULTS"]
2
+
3
+ ENGINE_DEFAULTS = {"pool_pre_ping": True,
4
+ "pool_recycle": 1800}
5
+ ENGINE_DEFAULTS_QUEUE_POOL = {"pool_use_lifo": True}
6
+ SESSION_DEFAULTS = {"expire_on_commit": False}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-general-be-lib
3
- Version: 0.11.0
3
+ Version: 0.11.2
4
4
  Summary: General purpose backend library — SQLAlchemy CRUD/Geometry repositories, FastAPI exceptions, Pydantic base models, logger utilities.
5
5
  Author-email: Andrea Di Placido <a.diplacido@arpes.it>, "Arpes S.r.l." <it.admin@arpes.it>
6
6
  License: MIT
@@ -10,16 +10,16 @@ general/exception/exception_interface.py,sha256=k7KreAYMwKPQQghkCissdu3ASZZqrRFW
10
10
  general/interface/__init__.py,sha256=G11sI1Oxtb-Z_-ORAuKS_Kkdwopt1uXmEXYtZEJYiLs,445
11
11
  general/interface/base/__init__.py,sha256=fA1hdSY5TX6k_UpvA0eAfYeNWkXY6fPrHBqZVIdf6PY,270
12
12
  general/interface/base/base_model.py,sha256=aIzrRZVUytmbgmEH1bya29rVFOm-Njinn_JXkgkBrr8,2575
13
- general/interface/base/declarative_base.py,sha256=IyfgH8eJ_dlh3h9MBKC7kNbb1TeJxWTeGagQASqWCrU,8910
13
+ general/interface/base/declarative_base.py,sha256=1AAjGQ7df8MQWcJAGQJlg5N_eTc93FHbMhgh4nIm7a0,9293
14
14
  general/interface/metadata/__init__.py,sha256=pXKYY4uO92eQI3gtuG4FKZbBi76gu-VJLxaAy-emeP8,474
15
- general/interface/metadata/crud_metadata.py,sha256=NzTc1Q98zoDWaUTbvLbZEZgOmyji_dAl9KLajYB0_lI,48070
15
+ general/interface/metadata/crud_metadata.py,sha256=SfV2__zgkTTeX1opLHDMRIeyB1DKiObr7pGOHkGVFlo,48120
16
16
  general/interface/metadata/geom_metadata.py,sha256=xWNZnWhN_Om91pcqSsURKi5EUYNZh444zDqMwoOpq84,15508
17
17
  general/interface/mixin/__init__.py,sha256=M5-e6T_R63Utwh3_WcmoE3wanwIZjNjbgLYrrFlSpTA,659
18
18
  general/interface/mixin/audit_mixin.py,sha256=N2JDD9JxXDMeBqu0yAlhVWFOK3EeUA2b215hPvXytUU,1421
19
19
  general/interface/mixin/softdelete_mixin.py,sha256=526luzM4DBCorcq99kZ6BYqtQKKJCpnxX9rSEigfyIU,2148
20
20
  general/interface/mixin/timestamp_mixin.py,sha256=wmcIx2Y8jgVqg9A-1E61BvkcKCo52ZjKNHeKfXJmUl0,2220
21
21
  general/interface/repository/__init__.py,sha256=eWoNy35LVu6sDrK5ju7VAeoclknKO0-yTgjVckJpi8s,321
22
- general/interface/repository/crud_repository.py,sha256=hUpFzY9ANWJQh5Z_cvwrM4YH8FXX5mTobEFnX5XltPg,55559
22
+ general/interface/repository/crud_repository.py,sha256=2Jh_Y86QWFF14HnopvYSSVablmhkOdFe799VRj0TQFI,55629
23
23
  general/interface/repository/geometry_repository.py,sha256=Fmv0qhfqumnU5fiETMMAmiB0UyG43b19jlPXQ8cJ9CU,11289
24
24
  general/interface/repository/many_to_many_repository.py,sha256=KRJ2SMUGDYNoGV-ea541wlWg0FW4NQ_Ry85aJBarmC8,11183
25
25
  general/interface/repository/view_repository.py,sha256=wxDGw7kenuVrDd9nfh7-omw2m9Jex5WzF_lhEiqPoA0,7902
@@ -33,8 +33,10 @@ general/interface/repository/handler/json_ilike_handler.py,sha256=icfA4dO8E_W_KU
33
33
  general/interface/repository/handler/or_handler.py,sha256=UOjIh77H4y-x434YGLYRfVIXKnod1M5XPiMf71V2JTg,3137
34
34
  general/interface/repository/handler/soft_delete_handler.py,sha256=1WD1n6q5plyJ0RDniJcEwNlic1WJqXvSlCj99VLc_3A,4100
35
35
  general/interface/repository/handler/statement_manager.py,sha256=EBv2ApCBYfo18fqoALftMxsN-_2Yq9n-yzfEQkh9ZLg,6612
36
- python_general_be_lib-0.11.0.dist-info/licenses/LICENSE,sha256=iUaO1XZyB9P3Tmog0OILuTisP6vXGe3QKz-4yRTxOFk,1069
37
- python_general_be_lib-0.11.0.dist-info/METADATA,sha256=3EeRRYZfvh6YbWkDemsyPWhYh4CZF0NtA19iIfPT1dg,3410
38
- python_general_be_lib-0.11.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
39
- python_general_be_lib-0.11.0.dist-info/top_level.txt,sha256=tTZePW8_CNUqSgKFd2SEH72ZbnhS0OYjRsgcv0ikSFY,8
40
- python_general_be_lib-0.11.0.dist-info/RECORD,,
36
+ general/utils/__init__.py,sha256=_SPe88reIZ0JxwK7mp-u_p-9c4hCcZ-daUihi0gymNk,103
37
+ general/utils/consts.py,sha256=nE75Ud7sVuDw9K_xmIJNjL_5f_BVJmwGNPGFYc26H3Y,264
38
+ python_general_be_lib-0.11.2.dist-info/licenses/LICENSE,sha256=iUaO1XZyB9P3Tmog0OILuTisP6vXGe3QKz-4yRTxOFk,1069
39
+ python_general_be_lib-0.11.2.dist-info/METADATA,sha256=I67gtlqhPnQO3MMb7REVx8989XeHBIRAkQwxZ53r-No,3410
40
+ python_general_be_lib-0.11.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
41
+ python_general_be_lib-0.11.2.dist-info/top_level.txt,sha256=tTZePW8_CNUqSgKFd2SEH72ZbnhS0OYjRsgcv0ikSFY,8
42
+ python_general_be_lib-0.11.2.dist-info/RECORD,,