cognite-neat 1.0.2__py3-none-any.whl → 1.0.4__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.
- cognite/neat/_data_model/deployer/data_classes.py +1 -1
- cognite/neat/_data_model/deployer/deployer.py +5 -1
- cognite/neat/_data_model/validation/dms/_base.py +55 -13
- cognite/neat/_session/_physical.py +1 -1
- cognite/neat/_version.py +1 -1
- {cognite_neat-1.0.2.dist-info → cognite_neat-1.0.4.dist-info}/METADATA +1 -1
- {cognite_neat-1.0.2.dist-info → cognite_neat-1.0.4.dist-info}/RECORD +9 -9
- {cognite_neat-1.0.2.dist-info → cognite_neat-1.0.4.dist-info}/WHEEL +0 -0
- {cognite_neat-1.0.2.dist-info → cognite_neat-1.0.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -496,7 +496,7 @@ class AppliedChanges(BaseDeployObject):
|
|
|
496
496
|
|
|
497
497
|
|
|
498
498
|
class DeploymentResult(BaseDeployObject):
|
|
499
|
-
status: Literal["success", "failure", "partial", "pending"]
|
|
499
|
+
status: Literal["success", "failure", "partial", "pending", "recovered", "recovery_failed"]
|
|
500
500
|
plan: list[ResourceDeploymentPlan]
|
|
501
501
|
snapshot: SchemaSnapshot
|
|
502
502
|
responses: AppliedChanges | None = None
|
|
@@ -117,7 +117,11 @@ class SchemaDeployer(OnSuccessResultProducer):
|
|
|
117
117
|
if not changes.is_success and self.options.auto_rollback:
|
|
118
118
|
recovery = self.apply_changes(changes.as_recovery_plan())
|
|
119
119
|
return DeploymentResult(
|
|
120
|
-
status="
|
|
120
|
+
status="recovered" if recovery.is_success else "recovery_failed",
|
|
121
|
+
plan=list(plan),
|
|
122
|
+
snapshot=snapshot,
|
|
123
|
+
responses=changes,
|
|
124
|
+
recovery=recovery,
|
|
121
125
|
)
|
|
122
126
|
return DeploymentResult(
|
|
123
127
|
status="success" if changes.is_success else "partial", plan=list(plan), snapshot=snapshot, responses=changes
|
|
@@ -224,27 +224,41 @@ class DataModelValidator(ABC):
|
|
|
224
224
|
RuntimeError: If a referenced view is not found in either local or CDF resources.
|
|
225
225
|
"""
|
|
226
226
|
|
|
227
|
-
if self.modus_operandi != "additive":
|
|
228
|
-
return self.local_resources.views_by_reference
|
|
229
|
-
|
|
230
227
|
merged_views: dict[ViewReference, ViewRequest] = {}
|
|
228
|
+
|
|
231
229
|
# Merge local views, combining properties if view exists in both
|
|
230
|
+
# if rebuild mode , self.view_references returns only local views ref
|
|
232
231
|
for view_ref in self.views_references:
|
|
233
232
|
cdf_view = self.cdf_resources.views_by_reference.get(view_ref)
|
|
234
233
|
local_view = self.local_resources.views_by_reference.get(view_ref)
|
|
235
234
|
|
|
236
|
-
if not cdf_view and not local_view:
|
|
235
|
+
if self.modus_operandi == "additive" and not cdf_view and not local_view:
|
|
237
236
|
raise RuntimeError(f"View {view_ref!s} not found in either local or CDF resources. This is a bug!")
|
|
237
|
+
elif self.modus_operandi == "rebuild" and not local_view:
|
|
238
|
+
raise RuntimeError(f"View {view_ref!s} not found in local resources. This is a bug!")
|
|
238
239
|
|
|
239
|
-
# this will later update of local properties and implements
|
|
240
240
|
merged_views[view_ref] = cast(ViewRequest, (cdf_view or local_view)).model_copy(deep=True)
|
|
241
241
|
|
|
242
|
+
# in additive mode, we start off with CDF view as base , which we will update with local
|
|
243
|
+
if (
|
|
244
|
+
self.modus_operandi == "additive"
|
|
245
|
+
or cast(ViewRequest, local_view).space != self.local_resources.data_model_reference.space
|
|
246
|
+
):
|
|
247
|
+
merged_views[view_ref] = cast(ViewRequest, (cdf_view or local_view)).model_copy(deep=True)
|
|
248
|
+
|
|
249
|
+
# rebuild mode
|
|
250
|
+
else:
|
|
251
|
+
merged_views[view_ref] = cast(ViewRequest, local_view).model_copy(deep=True)
|
|
252
|
+
|
|
253
|
+
# this will later update of local properties and implements
|
|
242
254
|
if local_view and local_view.properties:
|
|
243
255
|
if not merged_views[view_ref].properties:
|
|
244
256
|
merged_views[view_ref].properties = local_view.properties
|
|
245
257
|
else:
|
|
246
258
|
merged_views[view_ref].properties.update(local_view.properties)
|
|
247
259
|
|
|
260
|
+
# Special handling for properties which originates from implements
|
|
261
|
+
|
|
248
262
|
if local_view and local_view.implements:
|
|
249
263
|
if not merged_views[view_ref].implements:
|
|
250
264
|
merged_views[view_ref].implements = local_view.implements
|
|
@@ -253,6 +267,27 @@ class DataModelValidator(ABC):
|
|
|
253
267
|
if impl not in cast(list[ViewReference], merged_views[view_ref].implements):
|
|
254
268
|
cast(list[ViewReference], merged_views[view_ref].implements).append(impl)
|
|
255
269
|
|
|
270
|
+
# this handles an edge case where view is defined locally, implements another view, which is not
|
|
271
|
+
# present locally, but only in CDF, this could be typically the case when we define a view which
|
|
272
|
+
# implements a Core Data Model view, while not defining any of its own properties (not uncommon)
|
|
273
|
+
# locally in for example Excel sheets
|
|
274
|
+
for implement in local_view.implements:
|
|
275
|
+
if cdf_implement_view := self.cdf_resources.views_by_reference.get(implement):
|
|
276
|
+
# in rebuild mode, we skip CDF views from the same space as rebuild mode is supposed to
|
|
277
|
+
# rebuild everything from local resources only, but we still need to merge in properties
|
|
278
|
+
# from CDF implements from other spaces
|
|
279
|
+
if (
|
|
280
|
+
self.modus_operandi == "rebuild"
|
|
281
|
+
and cdf_implement_view.space == self.local_resources.data_model_reference.space
|
|
282
|
+
):
|
|
283
|
+
continue
|
|
284
|
+
|
|
285
|
+
for prop_name, prop in cdf_implement_view.properties.items():
|
|
286
|
+
if merged_views[view_ref].properties and prop_name not in merged_views[view_ref].properties:
|
|
287
|
+
merged_views[view_ref].properties[prop_name] = prop
|
|
288
|
+
elif not merged_views[view_ref].properties:
|
|
289
|
+
merged_views[view_ref].properties = {prop_name: prop}
|
|
290
|
+
|
|
256
291
|
return merged_views
|
|
257
292
|
|
|
258
293
|
@cached_property
|
|
@@ -274,23 +309,30 @@ class DataModelValidator(ABC):
|
|
|
274
309
|
RuntimeError: If a referenced container is not found in either local or CDF resources.
|
|
275
310
|
"""
|
|
276
311
|
|
|
277
|
-
if self.modus_operandi != "additive":
|
|
278
|
-
return self.local_resources.containers_by_reference
|
|
279
|
-
|
|
280
312
|
merged_containers: dict[ContainerReference, ContainerRequest] = {}
|
|
281
313
|
# Merge local containers, combining properties if container exists in both
|
|
282
314
|
for container_ref in self.container_references:
|
|
283
315
|
cdf_container = self.cdf_resources.containers_by_reference.get(container_ref)
|
|
284
316
|
local_container = self.local_resources.containers_by_reference.get(container_ref)
|
|
285
317
|
|
|
286
|
-
if not cdf_container and not local_container:
|
|
318
|
+
if self.modus_operandi == "additive" and not cdf_container and not local_container:
|
|
287
319
|
raise RuntimeError(
|
|
288
320
|
f"Container {container_ref!s} not found in either local or CDF resources. This is a bug!"
|
|
289
321
|
)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
322
|
+
elif self.modus_operandi == "rebuild" and not local_container:
|
|
323
|
+
raise RuntimeError(f"Container {container_ref!s} not found in local resources. This is a bug!")
|
|
324
|
+
|
|
325
|
+
# in additive mode, we start off with CDF container as base , which we will update with local
|
|
326
|
+
if (
|
|
327
|
+
self.modus_operandi == "additive"
|
|
328
|
+
or cast(ContainerRequest, local_container).space != self.local_resources.data_model_reference.space
|
|
329
|
+
):
|
|
330
|
+
merged_containers[container_ref] = cast(
|
|
331
|
+
ContainerRequest, (cdf_container or local_container)
|
|
332
|
+
).model_copy(deep=True)
|
|
333
|
+
|
|
334
|
+
else: # rebuild mode
|
|
335
|
+
merged_containers[container_ref] = cast(ContainerRequest, local_container).model_copy(deep=True)
|
|
294
336
|
|
|
295
337
|
if local_container and local_container.properties:
|
|
296
338
|
if not merged_containers[container_ref].properties:
|
|
@@ -234,7 +234,7 @@ class WritePhysicalDataModel:
|
|
|
234
234
|
|
|
235
235
|
return self._store.write_physical(writer, file_path=file_path)
|
|
236
236
|
|
|
237
|
-
def cdf(self, dry_run: bool = True, rollback: bool =
|
|
237
|
+
def cdf(self, dry_run: bool = True, rollback: bool = False, drop_data: bool = False) -> None:
|
|
238
238
|
"""Write physical data model with views, containers, and spaces that are in the same space as the data model
|
|
239
239
|
to CDF.
|
|
240
240
|
|
cognite/neat/_version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "1.0.
|
|
1
|
+
__version__ = "1.0.4"
|
|
2
2
|
__engine__ = "^2.0.4"
|
|
@@ -2,7 +2,7 @@ cognite/neat/__init__.py,sha256=u5EhnGuNS2GKydU6lVFCNrBpHBBKUnCDAE63Cqk__eo,244
|
|
|
2
2
|
cognite/neat/_config.py,sha256=NXObeA-860LV40KlY4orsqjMGACa0jKRz2UE5L9kH6U,8401
|
|
3
3
|
cognite/neat/_exceptions.py,sha256=ox-5hXpee4UJlPE7HpuEHV2C96aLbLKo-BhPDoOAzhA,1650
|
|
4
4
|
cognite/neat/_issues.py,sha256=wH1mnkrpBsHUkQMGUHFLUIQWQlfJ_qMfdF7q0d9wNhY,1871
|
|
5
|
-
cognite/neat/_version.py,sha256=
|
|
5
|
+
cognite/neat/_version.py,sha256=PG0hTrgdtokkHUdUcZQhG_UiE_vFIC9YHCENYSPb91w,44
|
|
6
6
|
cognite/neat/legacy.py,sha256=eI2ecxOV8ilGHyLZlN54ve_abtoK34oXognkFv3yvF0,219
|
|
7
7
|
cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
cognite/neat/_client/__init__.py,sha256=75Bh7eGhaN4sOt3ZcRzHl7pXaheu1z27kmTHeaI05vo,114
|
|
@@ -26,8 +26,8 @@ cognite/neat/_data_model/deployer/_differ_container.py,sha256=mcy7PhUOfnvAxnZWNo
|
|
|
26
26
|
cognite/neat/_data_model/deployer/_differ_data_model.py,sha256=iA7Xp-7NRvzZJXLLpJaLebkKKpv_VCBKPX6f-RU9wBk,1864
|
|
27
27
|
cognite/neat/_data_model/deployer/_differ_space.py,sha256=J_AaqiseLpwQsOkKc7gmho4U2oSWAGVeEdQNepZiWw0,343
|
|
28
28
|
cognite/neat/_data_model/deployer/_differ_view.py,sha256=g1xHwsoxFUaTOTtQa19nntKF3rxFzc2FxpKKFAUN_NE,11412
|
|
29
|
-
cognite/neat/_data_model/deployer/data_classes.py,sha256=
|
|
30
|
-
cognite/neat/_data_model/deployer/deployer.py,sha256=
|
|
29
|
+
cognite/neat/_data_model/deployer/data_classes.py,sha256=NTvLUYb_HbpzByKe_ZPvb-arOOs_YVfTjk3LzGpEHs0,23082
|
|
30
|
+
cognite/neat/_data_model/deployer/deployer.py,sha256=9ZFf9QAZEnyqmX3b4zSkdf5t3A1wnU6cYGDNut_KKuQ,18390
|
|
31
31
|
cognite/neat/_data_model/exporters/__init__.py,sha256=AskjmB_0Vqib4kN84bWt8-M8nO42QypFf-l-E8oA5W8,482
|
|
32
32
|
cognite/neat/_data_model/exporters/_api_exporter.py,sha256=G9cqezy_SH8VdhW4o862qBHh_QcbzfP6O1Yyjvdpeog,1579
|
|
33
33
|
cognite/neat/_data_model/exporters/_base.py,sha256=rG_qAU5i5Hh5hUMep2UmDFFZID4x3LEenL6Z5C6N8GQ,646
|
|
@@ -76,7 +76,7 @@ cognite/neat/_data_model/models/entities/_parser.py,sha256=zef_pSDZYMZrJl4IKreFD
|
|
|
76
76
|
cognite/neat/_data_model/validation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
77
|
cognite/neat/_data_model/validation/dms/__init__.py,sha256=kKD18-Bg_G-w11Cs7Wv_TKV0C_q62Pm2RKLpOz27ar4,2642
|
|
78
78
|
cognite/neat/_data_model/validation/dms/_ai_readiness.py,sha256=hFrnRzBBf143ejLHRk3BpylzrVpxUX537BouOlv4PFE,15552
|
|
79
|
-
cognite/neat/_data_model/validation/dms/_base.py,sha256=
|
|
79
|
+
cognite/neat/_data_model/validation/dms/_base.py,sha256=207zS_aTQYZc16jLHfJSz5Idma0ZAgIuZZjVFnN0q4A,16271
|
|
80
80
|
cognite/neat/_data_model/validation/dms/_connections.py,sha256=6ea8WZNqYT9SPluwXvg0mgDJpzZMqpPC5xonbdLrT4E,27305
|
|
81
81
|
cognite/neat/_data_model/validation/dms/_consistency.py,sha256=uJ6coAVupD3WfeeXxoCIebM8WSnR78GXBXIBnN59aao,2477
|
|
82
82
|
cognite/neat/_data_model/validation/dms/_containers.py,sha256=UuvzrBBw45F5f9uzCh97lW4t7m7XIIT1I9FnzzYUYv4,7533
|
|
@@ -85,7 +85,7 @@ cognite/neat/_data_model/validation/dms/_orchestrator.py,sha256=XrozA27fbzWCuCQK
|
|
|
85
85
|
cognite/neat/_data_model/validation/dms/_views.py,sha256=M4egIa7UAMGtZlqzIxx6ZzL4e_qo8GbDGh7vs9wywD8,4266
|
|
86
86
|
cognite/neat/_session/__init__.py,sha256=owqW5Mml2DSZx1AvPvwNRTBngfhBNrQ6EH-7CKL7Jp0,61
|
|
87
87
|
cognite/neat/_session/_issues.py,sha256=E8UQeSJURg2dm4MF1pfD9dp-heSRT7pgQZgKlD1-FGs,2723
|
|
88
|
-
cognite/neat/_session/_physical.py,sha256=
|
|
88
|
+
cognite/neat/_session/_physical.py,sha256=plYgj4D6e8iOA0AP4Pw-yC_WZFxip74rnXo4iFatWT0,11378
|
|
89
89
|
cognite/neat/_session/_result.py,sha256=po2X4s-Tioe0GQAGCfK862hKXNRX5YjJZsEzNcTC8nI,7879
|
|
90
90
|
cognite/neat/_session/_session.py,sha256=STrX0Q7dXw9W7y9LFgLV_3XoYJk1fGSyBalSblLEj5w,3264
|
|
91
91
|
cognite/neat/_session/_wrappers.py,sha256=9t_MnJ0Sw_v-f6oTIh8dtAT-3oEbqumGuND97aPCC3M,3581
|
|
@@ -312,7 +312,7 @@ cognite/neat/_v0/session/_to.py,sha256=AnsRSDDdfFyYwSgi0Z-904X7WdLtPfLlR0x1xsu_j
|
|
|
312
312
|
cognite/neat/_v0/session/_wizard.py,sha256=baPJgXAAF3d1bn4nbIzon1gWfJOeS5T43UXRDJEnD3c,1490
|
|
313
313
|
cognite/neat/_v0/session/exceptions.py,sha256=jv52D-SjxGfgqaHR8vnpzo0SOJETIuwbyffSWAxSDJw,3495
|
|
314
314
|
cognite/neat/_v0/session/_state/README.md,sha256=o6N7EL98lgyWffw8IoEUf2KG5uSKveD5__TW45YzVjA,902
|
|
315
|
-
cognite_neat-1.0.
|
|
316
|
-
cognite_neat-1.0.
|
|
317
|
-
cognite_neat-1.0.
|
|
318
|
-
cognite_neat-1.0.
|
|
315
|
+
cognite_neat-1.0.4.dist-info/METADATA,sha256=5n7OsUlUVMaXmo5m9O4VQsSsWleV2xcjomJdMjyMBTE,6030
|
|
316
|
+
cognite_neat-1.0.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
317
|
+
cognite_neat-1.0.4.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
|
|
318
|
+
cognite_neat-1.0.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|