industrial-model 1.1.4__tar.gz → 1.2.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.
- {industrial_model-1.1.4 → industrial_model-1.2.0}/PKG-INFO +6 -2
- {industrial_model-1.1.4 → industrial_model-1.2.0}/README.md +5 -1
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/__init__.py +1 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/search_mapper.py +3 -1
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/queries/models.py +7 -1
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/statements/__init__.py +4 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/pyproject.toml +1 -1
- {industrial_model-1.1.4 → industrial_model-1.2.0}/.gitignore +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/LICENSE +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/__init__.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/aggregation_mapper.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/filter_mapper.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/models.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/optimizer.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/query_mapper.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/query_result_mapper.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/sort_mapper.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/upsert_mapper.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/utils.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/view_mapper.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/config.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/constants.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/engines/__init__.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/engines/_internal.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/engines/async_engine.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/engines/engine.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/models/__init__.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/models/base.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/models/entities.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/models/schemas.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/models/utils.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/py.typed +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/queries/__init__.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/queries/params.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/queries/utils.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/statements/expressions.py +0 -0
- {industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: industrial-model
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Industrial Model ORM
|
|
5
5
|
Project-URL: Homepage, https://github.com/lucasrosaalves/industrial-model
|
|
6
6
|
Project-URL: Source, https://github.com/lucasrosaalves/industrial-model
|
|
@@ -244,7 +244,11 @@ from industrial_model import search
|
|
|
244
244
|
search_statement = (
|
|
245
245
|
search(CogniteAsset)
|
|
246
246
|
.where(col(CogniteAsset.aliases).contains_any_(["my_alias"]))
|
|
247
|
-
.query_by(
|
|
247
|
+
.query_by(
|
|
248
|
+
query="my fuzzy name",
|
|
249
|
+
query_properties=[CogniteAsset.name],
|
|
250
|
+
operator="AND",
|
|
251
|
+
)
|
|
248
252
|
)
|
|
249
253
|
|
|
250
254
|
search_result = engine.search(search_statement)
|
|
@@ -220,7 +220,11 @@ from industrial_model import search
|
|
|
220
220
|
search_statement = (
|
|
221
221
|
search(CogniteAsset)
|
|
222
222
|
.where(col(CogniteAsset.aliases).contains_any_(["my_alias"]))
|
|
223
|
-
.query_by(
|
|
223
|
+
.query_by(
|
|
224
|
+
query="my fuzzy name",
|
|
225
|
+
query_properties=[CogniteAsset.name],
|
|
226
|
+
operator="AND",
|
|
227
|
+
)
|
|
224
228
|
)
|
|
225
229
|
|
|
226
230
|
search_result = engine.search(search_statement)
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/search_mapper.py
RENAMED
|
@@ -4,7 +4,7 @@ import cognite.client.data_classes.filters as filters
|
|
|
4
4
|
from cognite.client.data_classes.data_modeling import InstanceSort, View
|
|
5
5
|
|
|
6
6
|
from industrial_model.models import TViewInstance
|
|
7
|
-
from industrial_model.statements import SearchStatement
|
|
7
|
+
from industrial_model.statements import SearchOperationTypes, SearchStatement
|
|
8
8
|
|
|
9
9
|
from .filter_mapper import (
|
|
10
10
|
FilterMapper,
|
|
@@ -21,6 +21,7 @@ class SearchQuery:
|
|
|
21
21
|
query_properties: list[str] | None
|
|
22
22
|
limit: int
|
|
23
23
|
sort: list[InstanceSort]
|
|
24
|
+
operator: SearchOperationTypes | None
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class SearchMapper:
|
|
@@ -47,4 +48,5 @@ class SearchMapper:
|
|
|
47
48
|
query_properties=statement_values.query_properties,
|
|
48
49
|
limit=statement_values.limit,
|
|
49
50
|
sort=sort_clauses,
|
|
51
|
+
operator=statement_values.search_operator,
|
|
50
52
|
)
|
|
@@ -4,6 +4,7 @@ from industrial_model.models import RootModel, TAggregatedViewInstance, TViewIns
|
|
|
4
4
|
from industrial_model.statements import (
|
|
5
5
|
AggregateTypes,
|
|
6
6
|
AggregationStatement,
|
|
7
|
+
SearchOperationTypes,
|
|
7
8
|
SearchStatement,
|
|
8
9
|
Statement,
|
|
9
10
|
aggregate,
|
|
@@ -37,6 +38,7 @@ class BasePaginatedQuery(BaseQuery):
|
|
|
37
38
|
class BaseSearchQuery(RootModel):
|
|
38
39
|
query: str | None = None
|
|
39
40
|
query_properties: list[Any] | None = None
|
|
41
|
+
query_operator: SearchOperationTypes | None = None
|
|
40
42
|
limit: int = 1000
|
|
41
43
|
|
|
42
44
|
def to_statement(
|
|
@@ -45,7 +47,11 @@ class BaseSearchQuery(RootModel):
|
|
|
45
47
|
statement = search(entity)
|
|
46
48
|
_set_base_statement_params(self, statement)
|
|
47
49
|
if self.query:
|
|
48
|
-
statement.query_by(
|
|
50
|
+
statement.query_by(
|
|
51
|
+
self.query,
|
|
52
|
+
self.query_properties,
|
|
53
|
+
self.query_operator,
|
|
54
|
+
)
|
|
49
55
|
statement.limit(self.limit)
|
|
50
56
|
|
|
51
57
|
return statement
|
|
@@ -16,6 +16,7 @@ from .expressions import (
|
|
|
16
16
|
|
|
17
17
|
T = TypeVar("T")
|
|
18
18
|
AggregateTypes = Literal["count", "avg", "min", "max", "sum"]
|
|
19
|
+
SearchOperationTypes = Literal["OR", "AND"]
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
def _create_column(property: str | Column | Any) -> Column:
|
|
@@ -36,6 +37,7 @@ class BaseStatementValues:
|
|
|
36
37
|
|
|
37
38
|
query: str | None = field(init=False, default=None)
|
|
38
39
|
query_properties: list[str] | None = field(init=False, default=None)
|
|
40
|
+
search_operator: SearchOperationTypes | None = field(init=False, default=None)
|
|
39
41
|
|
|
40
42
|
|
|
41
43
|
@dataclass
|
|
@@ -106,6 +108,7 @@ class SearchStatement(BaseStatement[T]):
|
|
|
106
108
|
self,
|
|
107
109
|
query: str,
|
|
108
110
|
query_properties: list[Column] | list[str] | list[Any] | None = None,
|
|
111
|
+
operation: SearchOperationTypes | None = None,
|
|
109
112
|
) -> Self:
|
|
110
113
|
self._values.query = query
|
|
111
114
|
self._values.query_properties = (
|
|
@@ -120,6 +123,7 @@ class SearchStatement(BaseStatement[T]):
|
|
|
120
123
|
if query_properties
|
|
121
124
|
else None
|
|
122
125
|
)
|
|
126
|
+
self._values.search_operator = operation
|
|
123
127
|
return self
|
|
124
128
|
|
|
125
129
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/filter_mapper.py
RENAMED
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/models.py
RENAMED
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/optimizer.py
RENAMED
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/query_mapper.py
RENAMED
|
File without changes
|
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/sort_mapper.py
RENAMED
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/upsert_mapper.py
RENAMED
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/utils.py
RENAMED
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/cognite_adapters/view_mapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{industrial_model-1.1.4 → industrial_model-1.2.0}/industrial_model/statements/expressions.py
RENAMED
|
File without changes
|
|
File without changes
|