python-general-be-lib 0.2.0__tar.gz → 0.3.0__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 (34) hide show
  1. {python_general_be_lib-0.2.0/python_general_be_lib.egg-info → python_general_be_lib-0.3.0}/PKG-INFO +1 -1
  2. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/handler/__init__.py +1 -0
  3. python_general_be_lib-0.3.0/general/interface/repository/handler/json_handler.py +25 -0
  4. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/pyproject.toml +1 -1
  5. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0/python_general_be_lib.egg-info}/PKG-INFO +1 -1
  6. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/python_general_be_lib.egg-info/SOURCES.txt +1 -0
  7. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/setup.py +1 -1
  8. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/LICENSE +0 -0
  9. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/README.md +0 -0
  10. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/__init__.py +0 -0
  11. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/exception/__init__.py +0 -0
  12. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/exception/access_exceptions.py +0 -0
  13. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/exception/crud_exceptions.py +0 -0
  14. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/exception/exception_interface.py +0 -0
  15. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/base/__init__.py +0 -0
  16. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/base/base_model.py +0 -0
  17. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/base/declarative_base.py +0 -0
  18. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/metadata/__init__.py +0 -0
  19. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/metadata/crud_metadata.py +0 -0
  20. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/metadata/geom_metadata.py +0 -0
  21. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/__init__.py +0 -0
  22. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/crud_repository.py +0 -0
  23. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/geometry_repository.py +0 -0
  24. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/handler/base_handler.py +0 -0
  25. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/handler/ilike_handler.py +0 -0
  26. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/handler/interval_handler.py +0 -0
  27. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/many_to_many_repository.py +0 -0
  28. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/interface/repository/view_repository.py +0 -0
  29. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/logger.py +0 -0
  30. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/general/paginator_dto.py +0 -0
  31. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/python_general_be_lib.egg-info/dependency_links.txt +0 -0
  32. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/python_general_be_lib.egg-info/requires.txt +0 -0
  33. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/python_general_be_lib.egg-info/top_level.txt +0 -0
  34. {python_general_be_lib-0.2.0 → python_general_be_lib-0.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-general-be-lib
3
- Version: 0.2.0
3
+ Version: 0.3.0
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
@@ -1,3 +1,4 @@
1
1
  from .base_handler import *
2
2
  from .ilike_handler import *
3
3
  from .interval_handler import *
4
+ from .json_handler import *
@@ -0,0 +1,25 @@
1
+ __all__ = ["JsonHandler"]
2
+
3
+ from typing import Any
4
+
5
+ from sqlalchemy import Column, Select, Update, Delete
6
+ from sqlalchemy.sql.base import ReadOnlyColumnCollection
7
+
8
+ from .base_handler import BaseHandler
9
+
10
+
11
+ class JsonHandler(BaseHandler):
12
+ __slots__ = "json_column"
13
+ json_column: str
14
+
15
+ def __init__(self, columns: ReadOnlyColumnCollection[str, Column[Any]]):
16
+ self.columns = columns
17
+ self.json_column = {key for key, column in columns.items() if column.type.python_type == dict}.pop()
18
+
19
+ def prepare_statement(self, stmt: Select | Update | Delete, **where):
20
+ json_keys = {key for key in where.keys() if key not in self.columns}
21
+ json_conditions = {key: where.pop(key) for key in json_keys}
22
+
23
+ stmt = super().prepare_statement(stmt=stmt, **where)
24
+ stmt = stmt.where(*[self.columns[self.json_column][key].as_string() == str(value) for key, value in json_conditions.items()])
25
+ return stmt
@@ -4,7 +4,7 @@ build-backend = "setuptools.backends.legacy:build"
4
4
 
5
5
  [project]
6
6
  name = "python-general-be-lib"
7
- version = "0.2.0"
7
+ version = "0.3.0"
8
8
  description = "General purpose backend library — SQLAlchemy CRUD/Geometry repositories, FastAPI exceptions, Pydantic base models, logger utilities."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-general-be-lib
3
- Version: 0.2.0
3
+ Version: 0.3.0
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
@@ -24,6 +24,7 @@ general/interface/repository/handler/__init__.py
24
24
  general/interface/repository/handler/base_handler.py
25
25
  general/interface/repository/handler/ilike_handler.py
26
26
  general/interface/repository/handler/interval_handler.py
27
+ general/interface/repository/handler/json_handler.py
27
28
  python_general_be_lib.egg-info/PKG-INFO
28
29
  python_general_be_lib.egg-info/SOURCES.txt
29
30
  python_general_be_lib.egg-info/dependency_links.txt
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="python-general-be-lib",
5
- version="0.2.0",
5
+ version="0.3.0",
6
6
  packages=find_packages(include=["general*"]),
7
7
  python_requires=">=3.12",
8
8
  install_requires=[