python-general-be-lib 0.8.1__py3-none-any.whl → 0.8.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.
- general/interface/base/declarative_base.py +9 -5
- general/interface/repository/crud_repository.py +4 -2
- {python_general_be_lib-0.8.1.dist-info → python_general_be_lib-0.8.2.dist-info}/METADATA +1 -1
- {python_general_be_lib-0.8.1.dist-info → python_general_be_lib-0.8.2.dist-info}/RECORD +7 -7
- {python_general_be_lib-0.8.1.dist-info → python_general_be_lib-0.8.2.dist-info}/WHEEL +0 -0
- {python_general_be_lib-0.8.1.dist-info → python_general_be_lib-0.8.2.dist-info}/licenses/LICENSE +0 -0
- {python_general_be_lib-0.8.1.dist-info → python_general_be_lib-0.8.2.dist-info}/top_level.txt +0 -0
|
@@ -45,15 +45,19 @@ class Base:
|
|
|
45
45
|
default_values = dict()
|
|
46
46
|
mapper: Mapper = inspect(cls)
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
# ``mapper.columns`` è indicizzato per **nome di attributo** e non forza la
|
|
49
|
+
# configurazione dei mapper: ``column_attrs``/``attrs``/``relationships`` la
|
|
50
|
+
# forzerebbero, e chiamare ``to_pydantic`` a import-time — il pattern
|
|
51
|
+
# documentato — romperebbe le relationship con forward-ref non ancora
|
|
52
|
+
# risolvibili (stessa ragione per cui ``relationship_attributes`` è lazy).
|
|
53
|
+
selected = [(name, column) for name, column in mapper.columns.items()
|
|
54
|
+
if include_only is None or name in include_only]
|
|
49
55
|
|
|
50
56
|
model_name = f"{cls.__name__}Model" if not model_name else model_name
|
|
51
57
|
fields = dict()
|
|
52
|
-
field_values = {
|
|
58
|
+
field_values = {name: None if full_optional else ... for name, _ in selected}
|
|
53
59
|
field_values.update(default_values)
|
|
54
|
-
for
|
|
55
|
-
col = prop.columns[0]
|
|
56
|
-
field_name = prop.key
|
|
60
|
+
for field_name, col in selected:
|
|
57
61
|
if isinstance(col.type, Geometry):
|
|
58
62
|
field_type = Optional[WKBElement] if col.nullable or full_optional else WKBElement
|
|
59
63
|
else:
|
|
@@ -41,7 +41,9 @@ def _reduced_model(entity: Type[Base], columns: frozenset[str]) -> Type[BaseMode
|
|
|
41
41
|
ricostruire il TypeAdapter — mancherebbe il bersaglio a ogni richiesta, e il suo
|
|
42
42
|
`maxsize=None` tratterebbe una voce per classe generata.
|
|
43
43
|
"""
|
|
44
|
-
|
|
44
|
+
# ``mapper.columns`` è indicizzato per nome di attributo e non forza la
|
|
45
|
+
# configurazione dei mapper (a differenza di ``column_attrs``/``attrs``).
|
|
46
|
+
ordinate = [name for name in inspect(entity).columns.keys() if name in columns]
|
|
45
47
|
digest = hashlib.sha1("|".join(ordinate).encode()).hexdigest()[:8]
|
|
46
48
|
return entity.to_pydantic(
|
|
47
49
|
model_name=f"{entity.__name__}_{digest}",
|
|
@@ -131,7 +133,7 @@ class CrudRepository[Entity: Base | Type[Base]]:
|
|
|
131
133
|
|
|
132
134
|
|
|
133
135
|
def _retrieve_parsing_model(self, columns=None, exclude_columns=None):
|
|
134
|
-
selected_columns = set(columns) if columns else set(self.entity.
|
|
136
|
+
selected_columns = set(columns) if columns else set(inspect(self.entity).columns.keys())
|
|
135
137
|
if exclude_columns:
|
|
136
138
|
selected_columns -= set(exclude_columns)
|
|
137
139
|
if columns is None and not exclude_columns:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-general-be-lib
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.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
|
|
@@ -8,12 +8,12 @@ general/exception/crud_exceptions.py,sha256=C2XPcCDctTAt20-we3II4WbSEb4yCQK4MjgV
|
|
|
8
8
|
general/exception/exception_interface.py,sha256=TJ2Yd_RgwP22DWCzNXQSEAMXdRJsAoOH07RLBjY5IwU,1577
|
|
9
9
|
general/interface/base/__init__.py,sha256=SDlTi28M8rzJ9yiKefo5l7V3K109LnnBHW-SuZ-5JtM,58
|
|
10
10
|
general/interface/base/base_model.py,sha256=Tsy70uC6HHe194ZrQaX7pXROqobOkZIOB63VdagmFHE,2561
|
|
11
|
-
general/interface/base/declarative_base.py,sha256=
|
|
11
|
+
general/interface/base/declarative_base.py,sha256=GoW88wHg2cY7mCQCwxHXCIxI8KZiPiP3CDIFpRIOMHE,6135
|
|
12
12
|
general/interface/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
general/interface/metadata/crud_metadata.py,sha256=BFohkkpUd7w211NYqAD20X4ZpovrXH7BERA1_Rs4Dv0,23291
|
|
14
14
|
general/interface/metadata/geom_metadata.py,sha256=J5SMXMiDUXnzt7bNH12LIQO6S7jcLNf7Cm4CdLXv8Lg,12255
|
|
15
15
|
general/interface/repository/__init__.py,sha256=EcRukwf61Ua-9-JfM_ingVv1wXNRV8HBrrWwjj8m23w,136
|
|
16
|
-
general/interface/repository/crud_repository.py,sha256=
|
|
16
|
+
general/interface/repository/crud_repository.py,sha256=kFDEWw2zCMR4kkJTZKT1ndeAlfq9nW_fvotJB05C344,39725
|
|
17
17
|
general/interface/repository/geometry_repository.py,sha256=WUnYOr0YOKNt7_lBa5HlbkGAkYuAaSrXqK7i0BQOctw,12101
|
|
18
18
|
general/interface/repository/many_to_many_repository.py,sha256=ZyuK2fk5ZI9xE8xhZwk5Vb1QItnOxwEF5CGsemnMdn8,9197
|
|
19
19
|
general/interface/repository/view_repository.py,sha256=ZqekhnSvHH_CJFb546tjUwnwGbwzyxZMx-f7yUvOl50,6206
|
|
@@ -25,8 +25,8 @@ general/interface/repository/handler/json_handler.py,sha256=XNAgIkUGQX8ttTsqtqE8
|
|
|
25
25
|
general/interface/repository/handler/json_ilike_handler.py,sha256=NXqcS1YOtcOStdl7sp2cYqFMkEdcxoVmaNJewJEzL3M,4738
|
|
26
26
|
general/interface/repository/handler/or_handler.py,sha256=hZ4Nc-nTi7Nh-krPUIlyCEg3q6H0D96T_oMVAzxezKY,4839
|
|
27
27
|
general/interface/repository/handler/statement_manager.py,sha256=yCMR1vNnXYmmY4HwI2CDZLI513GzyVZniN31QJFGKKA,7080
|
|
28
|
-
python_general_be_lib-0.8.
|
|
29
|
-
python_general_be_lib-0.8.
|
|
30
|
-
python_general_be_lib-0.8.
|
|
31
|
-
python_general_be_lib-0.8.
|
|
32
|
-
python_general_be_lib-0.8.
|
|
28
|
+
python_general_be_lib-0.8.2.dist-info/licenses/LICENSE,sha256=iUaO1XZyB9P3Tmog0OILuTisP6vXGe3QKz-4yRTxOFk,1069
|
|
29
|
+
python_general_be_lib-0.8.2.dist-info/METADATA,sha256=K6q4fRebfmJK4DPgzsRpaLw5qFPfTT9tW5jmmQs6xyo,2962
|
|
30
|
+
python_general_be_lib-0.8.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
31
|
+
python_general_be_lib-0.8.2.dist-info/top_level.txt,sha256=tTZePW8_CNUqSgKFd2SEH72ZbnhS0OYjRsgcv0ikSFY,8
|
|
32
|
+
python_general_be_lib-0.8.2.dist-info/RECORD,,
|
|
File without changes
|
{python_general_be_lib-0.8.1.dist-info → python_general_be_lib-0.8.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{python_general_be_lib-0.8.1.dist-info → python_general_be_lib-0.8.2.dist-info}/top_level.txt
RENAMED
|
File without changes
|