industrial-model 0.1.24__py3-none-any.whl → 0.1.26__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.
- industrial_model/queries/models.py +5 -5
- industrial_model/queries/params.py +16 -4
- {industrial_model-0.1.24.dist-info → industrial_model-0.1.26.dist-info}/METADATA +1 -1
- {industrial_model-0.1.24.dist-info → industrial_model-0.1.26.dist-info}/RECORD +5 -5
- {industrial_model-0.1.24.dist-info → industrial_model-0.1.26.dist-info}/WHEEL +0 -0
|
@@ -18,7 +18,7 @@ class BaseQuery(RootModel):
|
|
|
18
18
|
|
|
19
19
|
for key, item in self.__class__.model_fields.items():
|
|
20
20
|
values = getattr(self, key)
|
|
21
|
-
if
|
|
21
|
+
if values is None:
|
|
22
22
|
continue
|
|
23
23
|
for metadata_item in item.metadata:
|
|
24
24
|
if isinstance(metadata_item, SortParam):
|
|
@@ -43,7 +43,7 @@ class BasePaginatedQuery(BaseQuery):
|
|
|
43
43
|
|
|
44
44
|
class BaseSearchQuery(RootModel):
|
|
45
45
|
query: str | None = None
|
|
46
|
-
query_properties: list[
|
|
46
|
+
query_properties: list[Any] | None = None
|
|
47
47
|
limit: int = 1000
|
|
48
48
|
|
|
49
49
|
def to_statement(
|
|
@@ -53,7 +53,7 @@ class BaseSearchQuery(RootModel):
|
|
|
53
53
|
|
|
54
54
|
for key, item in self.__class__.model_fields.items():
|
|
55
55
|
values = getattr(self, key)
|
|
56
|
-
if
|
|
56
|
+
if values is None:
|
|
57
57
|
continue
|
|
58
58
|
for metadata_item in item.metadata:
|
|
59
59
|
if isinstance(metadata_item, SortParam):
|
|
@@ -69,7 +69,7 @@ class BaseSearchQuery(RootModel):
|
|
|
69
69
|
|
|
70
70
|
class BaseAggregationQuery(RootModel):
|
|
71
71
|
aggregate: AggregateTypes | None = None
|
|
72
|
-
group_by_properties: list[
|
|
72
|
+
group_by_properties: list[Any] | None = None
|
|
73
73
|
aggregation_property: str | None = None
|
|
74
74
|
limit: int | None = None
|
|
75
75
|
|
|
@@ -80,7 +80,7 @@ class BaseAggregationQuery(RootModel):
|
|
|
80
80
|
|
|
81
81
|
for key, item in self.__class__.model_fields.items():
|
|
82
82
|
values = getattr(self, key)
|
|
83
|
-
if
|
|
83
|
+
if values is None:
|
|
84
84
|
continue
|
|
85
85
|
for metadata_item in item.metadata:
|
|
86
86
|
if isinstance(metadata_item, QueryParam | NestedQueryParam):
|
|
@@ -5,7 +5,7 @@ from industrial_model.constants import (
|
|
|
5
5
|
LEAF_EXPRESSION_OPERATORS,
|
|
6
6
|
SORT_DIRECTION,
|
|
7
7
|
)
|
|
8
|
-
from industrial_model.statements import LeafExpression
|
|
8
|
+
from industrial_model.statements import BoolExpression, Expression, LeafExpression
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
@dataclass
|
|
@@ -13,9 +13,21 @@ class QueryParam:
|
|
|
13
13
|
property: str
|
|
14
14
|
operator: LEAF_EXPRESSION_OPERATORS
|
|
15
15
|
|
|
16
|
-
def to_expression(self, value: Any) ->
|
|
16
|
+
def to_expression(self, value: Any) -> Expression:
|
|
17
17
|
if self.operator == "nested":
|
|
18
|
-
raise ValueError(
|
|
18
|
+
raise ValueError(
|
|
19
|
+
"Nested operator not allowed in QueryParam - use NestedQueryParam"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
if self.operator == "exists" and isinstance(value, bool) and not value:
|
|
23
|
+
return BoolExpression(
|
|
24
|
+
operator="not",
|
|
25
|
+
filters=[
|
|
26
|
+
LeafExpression(
|
|
27
|
+
property=self.property, operator=self.operator, value=True
|
|
28
|
+
)
|
|
29
|
+
],
|
|
30
|
+
)
|
|
19
31
|
|
|
20
32
|
return LeafExpression(
|
|
21
33
|
property=self.property,
|
|
@@ -29,7 +41,7 @@ class NestedQueryParam:
|
|
|
29
41
|
property: str
|
|
30
42
|
value: QueryParam
|
|
31
43
|
|
|
32
|
-
def to_expression(self, value: Any) ->
|
|
44
|
+
def to_expression(self, value: Any) -> Expression:
|
|
33
45
|
return LeafExpression(
|
|
34
46
|
property=self.property,
|
|
35
47
|
operator="nested",
|
|
@@ -23,10 +23,10 @@ industrial_model/models/base.py,sha256=iGhDjXqA5ULEQIFHtkMi7WYJl0nQq1wi8_zqOr-Ep
|
|
|
23
23
|
industrial_model/models/entities.py,sha256=tHOFjS-9XsaXVrZ-x0tZR1DWL2Cc8MHe82qsIazqmnM,2811
|
|
24
24
|
industrial_model/models/schemas.py,sha256=EoLK9GYdS-0DQ98myTP3wOU9YpWIJOfDSLOYZUy3xEY,4559
|
|
25
25
|
industrial_model/queries/__init__.py,sha256=0cF-KTTGHLhdFKe3T_5cEVHsTN95iAV7R6FUutvuoaU,317
|
|
26
|
-
industrial_model/queries/models.py,sha256=
|
|
27
|
-
industrial_model/queries/params.py,sha256=
|
|
26
|
+
industrial_model/queries/models.py,sha256=XS-50Ja11fVM5G7XTvrFf4OSUD3QO58rAKkkFBQ3Xbg,3255
|
|
27
|
+
industrial_model/queries/params.py,sha256=U2LCdmDs_jrROvJIsWdopAmZAhXrK2gDr4kuDlVK7Ug,1384
|
|
28
28
|
industrial_model/statements/__init__.py,sha256=rjLRo2KoazHQaOpmPkxbI3_Nm8NCkJxjpuqow6IZVSc,4221
|
|
29
29
|
industrial_model/statements/expressions.py,sha256=4ZZOcZroI5-4xRw4PXIRlufi0ARndE5zSbbxLDpR2Ec,4816
|
|
30
|
-
industrial_model-0.1.
|
|
31
|
-
industrial_model-0.1.
|
|
32
|
-
industrial_model-0.1.
|
|
30
|
+
industrial_model-0.1.26.dist-info/METADATA,sha256=ucUIAoAcw63yUQmLmrxaVijuuUp1rrQ4ctBo2RwR4Pc,6858
|
|
31
|
+
industrial_model-0.1.26.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
32
|
+
industrial_model-0.1.26.dist-info/RECORD,,
|
|
File without changes
|