industrial-model 0.1.18__py3-none-any.whl → 0.1.20__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/cognite_adapters/__init__.py +8 -3
- industrial_model/cognite_adapters/query_result_mapper.py +1 -1
- industrial_model/cognite_adapters/utils.py +1 -0
- industrial_model/engines/async_engine.py +3 -0
- industrial_model/engines/engine.py +5 -0
- industrial_model/models/schemas.py +1 -1
- {industrial_model-0.1.18.dist-info → industrial_model-0.1.20.dist-info}/METADATA +17 -1
- {industrial_model-0.1.18.dist-info → industrial_model-0.1.20.dist-info}/RECORD +9 -9
- {industrial_model-0.1.18.dist-info → industrial_model-0.1.20.dist-info}/WHEEL +0 -0
|
@@ -111,7 +111,7 @@ class CogniteAdapter:
|
|
|
111
111
|
operation = self._upsert_mapper.map(entries)
|
|
112
112
|
|
|
113
113
|
for node_chunk in operation.chunk_nodes():
|
|
114
|
-
logger.
|
|
114
|
+
logger.debug(
|
|
115
115
|
f"Upserting {len(node_chunk)} nodes (replace={replace})"
|
|
116
116
|
)
|
|
117
117
|
self._cognite_client.data_modeling.instances.apply(
|
|
@@ -120,7 +120,7 @@ class CogniteAdapter:
|
|
|
120
120
|
)
|
|
121
121
|
|
|
122
122
|
for edge_chunk in operation.chunk_edges():
|
|
123
|
-
logger.
|
|
123
|
+
logger.debug(
|
|
124
124
|
f"Upserting {len(edge_chunk)} edges (replace={replace})"
|
|
125
125
|
)
|
|
126
126
|
self._cognite_client.data_modeling.instances.apply(
|
|
@@ -129,11 +129,16 @@ class CogniteAdapter:
|
|
|
129
129
|
)
|
|
130
130
|
|
|
131
131
|
for edges_to_remove_chunk in operation.chunk_edges_to_delete():
|
|
132
|
-
logger.
|
|
132
|
+
logger.debug(f"Deleting {len(edges_to_remove_chunk)} edges")
|
|
133
133
|
self._cognite_client.data_modeling.instances.delete(
|
|
134
134
|
edges=[item.as_tuple() for item in edges_to_remove_chunk],
|
|
135
135
|
)
|
|
136
136
|
|
|
137
|
+
def delete(self, nodes: list[TViewInstance]) -> None:
|
|
138
|
+
self._cognite_client.data_modeling.instances.delete(
|
|
139
|
+
nodes=[item.as_tuple() for item in nodes],
|
|
140
|
+
)
|
|
141
|
+
|
|
137
142
|
def _query_dependencies_pages(
|
|
138
143
|
self,
|
|
139
144
|
cognite_query: CogniteQuery,
|
|
@@ -47,3 +47,6 @@ class AsyncEngine:
|
|
|
47
47
|
self, entries: list[TWritableViewInstance], replace: bool = False
|
|
48
48
|
) -> None:
|
|
49
49
|
return await run_async(self._engine.upsert, entries, replace)
|
|
50
|
+
|
|
51
|
+
async def delete_async(self, nodes: list[TViewInstance]) -> None:
|
|
52
|
+
return await run_async(self._engine.delete, nodes)
|
|
@@ -99,7 +99,7 @@ def _get_field_type(
|
|
|
99
99
|
entries: list[type[BaseModel] | None] = []
|
|
100
100
|
for arg in get_args(type_hint):
|
|
101
101
|
if _type_is_list_or_union(arg):
|
|
102
|
-
return _get_field_type(arg, visited_count)
|
|
102
|
+
return _get_field_type(arg, parent_type, visited_count)
|
|
103
103
|
entries.append(_cast_base_model(arg))
|
|
104
104
|
|
|
105
105
|
return _get_field_relations(entries, parent_type, visited_count)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: industrial-model
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.20
|
|
4
4
|
Summary: Industrial Model ORM
|
|
5
5
|
Author-email: Lucas Alves <lucasrosaalves@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python
|
|
@@ -229,6 +229,22 @@ class AggregateByNamePerson(AggregatedViewInstance):
|
|
|
229
229
|
aggregate_result = engine.aggregate(aggregate(AggregateByNamePerson, "count"))
|
|
230
230
|
|
|
231
231
|
|
|
232
|
+
|
|
233
|
+
# 9. Deletion
|
|
234
|
+
|
|
235
|
+
class Entity(ViewInstance):
|
|
236
|
+
view_config = ViewInstanceConfig(
|
|
237
|
+
view_external_id="Person"
|
|
238
|
+
)
|
|
239
|
+
name: str
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
statement = select(Entity).where(Entity.external_id == "Lucas")
|
|
243
|
+
person = engine.query_all_pages(statement)[0]
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
engine.delete([person])
|
|
247
|
+
|
|
232
248
|
```
|
|
233
249
|
|
|
234
250
|
---
|
|
@@ -3,29 +3,29 @@ industrial_model/config.py,sha256=LseCZ8JvewFejjElPUQWdmIQQUU2wnd43McDid_Rixs,47
|
|
|
3
3
|
industrial_model/constants.py,sha256=wtFdxkR9gojqekwXeyVCof6VUkJYuqjjgAgVVKrcxaw,450
|
|
4
4
|
industrial_model/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
industrial_model/utils.py,sha256=oh4AxwxXaWgIC2uolkCbvkgo0ququHB6yAPVIXy45Ts,663
|
|
6
|
-
industrial_model/cognite_adapters/__init__.py,sha256=
|
|
6
|
+
industrial_model/cognite_adapters/__init__.py,sha256=K-F0BjbF9yM_YilQ7U16t7-70aAsIWUaaU_uQOul418,5680
|
|
7
7
|
industrial_model/cognite_adapters/aggregation_mapper.py,sha256=rXt2BZ2jS3afD9d3B2t8aizL9TWnMnqCCNdzTn_XR3Y,2362
|
|
8
8
|
industrial_model/cognite_adapters/filter_mapper.py,sha256=X2BVp305v1Wt00DTZEnCooOG_g6Jo7bkj-NyfRtECAE,3952
|
|
9
9
|
industrial_model/cognite_adapters/models.py,sha256=2j2IS01uPkQEp9WdVk8seYzEqGcDdWFnpzXhusHB2zk,945
|
|
10
10
|
industrial_model/cognite_adapters/optimizer.py,sha256=BbbsA3r9ZKJt6mN1wVRZc046ov-vbml9_ESfurTNRUg,2477
|
|
11
11
|
industrial_model/cognite_adapters/query_mapper.py,sha256=3fEcaLsGjLKIh-g1BbMcffQ6rp99JeCW555iJo8JW44,6260
|
|
12
|
-
industrial_model/cognite_adapters/query_result_mapper.py,sha256=
|
|
12
|
+
industrial_model/cognite_adapters/query_result_mapper.py,sha256=0IhW8YVQM_EBMQM_NXlzl27CuzSUWGX4g7K9VMUVgPw,9507
|
|
13
13
|
industrial_model/cognite_adapters/sort_mapper.py,sha256=RJUAYlZGXoYzK0PwX63cibRF_L-MUq9g2ZsC2EeNIF4,696
|
|
14
14
|
industrial_model/cognite_adapters/upsert_mapper.py,sha256=tWEiBJQeeNz1HDu0AoBIfCw_LL156Zg4h7ORKlZ__uw,4870
|
|
15
|
-
industrial_model/cognite_adapters/utils.py,sha256=
|
|
15
|
+
industrial_model/cognite_adapters/utils.py,sha256=AyQxK8tDy-tAC6pji1ZzfAMsaVX2epiBhdwdCXRCPl4,4840
|
|
16
16
|
industrial_model/cognite_adapters/view_mapper.py,sha256=qvT25gwIgPdAqZf-oQEh0GylUi5KEPwjLNmIl5ISQGA,1474
|
|
17
17
|
industrial_model/engines/__init__.py,sha256=7aGHrUm2MxIq39vR8h0xu3i1zNOuT9H9U-q4lV3nErQ,102
|
|
18
|
-
industrial_model/engines/async_engine.py,sha256=
|
|
19
|
-
industrial_model/engines/engine.py,sha256=
|
|
18
|
+
industrial_model/engines/async_engine.py,sha256=AkEHiHaO0wYiU8fwEG8H9EzNTlLpn9ygRPt-p4cQl7A,1675
|
|
19
|
+
industrial_model/engines/engine.py,sha256=pZOvBbvIfa2aX2Ad8KnGntKmbZQmmvHqWzFvxEDc8xU,3224
|
|
20
20
|
industrial_model/models/__init__.py,sha256=AzJ0CyPK5PvUCX45FFtybl13tkukUvk2UAF_90s_LQ8,742
|
|
21
21
|
industrial_model/models/base.py,sha256=iGhDjXqA5ULEQIFHtkMi7WYJl0nQq1wi8_zqOr-Ep78,1649
|
|
22
22
|
industrial_model/models/entities.py,sha256=1ZmijxOXEAWocf3HTJ9a7ci5cJEjzA3hbt0QvVP8Gb8,2817
|
|
23
|
-
industrial_model/models/schemas.py,sha256
|
|
23
|
+
industrial_model/models/schemas.py,sha256=PXbCZTN5RHTLsufYYS3fwPcBzIBTJ48m9-hxBYXx-Yk,4625
|
|
24
24
|
industrial_model/queries/__init__.py,sha256=7aheTE5qs03rxWm9fmGWptbz_p9OIXXYD8if56cqs18,227
|
|
25
25
|
industrial_model/queries/models.py,sha256=iiHQ7-cfg0nukEv5PoCx9QPF-w1gVSnoNbXBOK9Mzeo,1185
|
|
26
26
|
industrial_model/queries/params.py,sha256=ehgCoR5n6E-tkEuoymZ2lkLcSzMaBAx_HnyJ7sWpqz0,964
|
|
27
27
|
industrial_model/statements/__init__.py,sha256=15LI9POLUdh6i3Zw0Aek0fVFfcTj8P8ZEa1Cli3pgXQ,3095
|
|
28
28
|
industrial_model/statements/expressions.py,sha256=Sar1cIvy3sYi7tkWJN3ylHlZ252oN2mZJpZ1TX9jN3s,4940
|
|
29
|
-
industrial_model-0.1.
|
|
30
|
-
industrial_model-0.1.
|
|
31
|
-
industrial_model-0.1.
|
|
29
|
+
industrial_model-0.1.20.dist-info/METADATA,sha256=ZkydcSIJvDKweNn0nW8NeT9AeLjxHbO9iuR8Wn_Dyr4,6419
|
|
30
|
+
industrial_model-0.1.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
31
|
+
industrial_model-0.1.20.dist-info/RECORD,,
|
|
File without changes
|