cognite-toolkit 0.6.99__py3-none-any.whl → 0.6.100__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_toolkit/_cdf_tk/constants.py +11 -0
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py +22 -0
- cognite_toolkit/_cdf_tk/storageio/_instances.py +34 -2
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
- cognite_toolkit/_resources/cdf.toml +1 -1
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.6.99.dist-info → cognite_toolkit-0.6.100.dist-info}/METADATA +1 -1
- {cognite_toolkit-0.6.99.dist-info → cognite_toolkit-0.6.100.dist-info}/RECORD +12 -12
- {cognite_toolkit-0.6.99.dist-info → cognite_toolkit-0.6.100.dist-info}/WHEEL +0 -0
- {cognite_toolkit-0.6.99.dist-info → cognite_toolkit-0.6.100.dist-info}/entry_points.txt +0 -0
- {cognite_toolkit-0.6.99.dist-info → cognite_toolkit-0.6.100.dist-info}/licenses/LICENSE +0 -0
|
@@ -161,6 +161,17 @@ COGNITE_TIME_SERIES_CONTAINER = ContainerId("cdf_cdm", "CogniteTimeSeries")
|
|
|
161
161
|
COGNITE_FILE_CONTAINER = ContainerId("cdf_cdm", "CogniteFile")
|
|
162
162
|
CDF_UNIT_SPACE = "cdf_cdm_units"
|
|
163
163
|
|
|
164
|
+
|
|
165
|
+
# Container properties that are read-only in DMS needs to be handled with extra care, as this aspect is not currently exposed by the API.
|
|
166
|
+
READONLY_CONTAINER_PROPERTIES = {
|
|
167
|
+
ContainerId(space="cdf_cdm", external_id="CogniteAsset"): {
|
|
168
|
+
"assetHierarchy_path_last_updated_time",
|
|
169
|
+
"assetHierarchy_path",
|
|
170
|
+
"assetHierarchy_root",
|
|
171
|
+
},
|
|
172
|
+
ContainerId(space="cdf_cdm", external_id="CogniteFile"): {"isUploaded", "uploadedTime"},
|
|
173
|
+
}
|
|
174
|
+
|
|
164
175
|
# Data Plugin Constants
|
|
165
176
|
DATA_DEFAULT_DIR = "data"
|
|
166
177
|
DATA_RESOURCE_DIR = "resources"
|
|
@@ -45,6 +45,7 @@ from cognite.client.data_classes.data_modeling import (
|
|
|
45
45
|
EdgeApplyList,
|
|
46
46
|
EdgeApplyResultList,
|
|
47
47
|
EdgeList,
|
|
48
|
+
MappedProperty,
|
|
48
49
|
Node,
|
|
49
50
|
NodeApply,
|
|
50
51
|
NodeApplyList,
|
|
@@ -74,6 +75,7 @@ from rich.console import Console
|
|
|
74
75
|
from rich.markup import escape
|
|
75
76
|
from rich.panel import Panel
|
|
76
77
|
|
|
78
|
+
from cognite_toolkit._cdf_tk import constants
|
|
77
79
|
from cognite_toolkit._cdf_tk.client import ToolkitClient
|
|
78
80
|
from cognite_toolkit._cdf_tk.client.data_classes.graphql_data_models import (
|
|
79
81
|
GraphQLDataModel,
|
|
@@ -669,6 +671,26 @@ class ViewCRUD(ResourceCRUD[ViewId, ViewApply, View, ViewApplyList, ViewList]):
|
|
|
669
671
|
self._view_by_id[view.as_id()] = view
|
|
670
672
|
return {view_id: self._view_by_id[view_id] for view_id in view_ids if view_id in self._view_by_id}
|
|
671
673
|
|
|
674
|
+
def get_readonly_properties(self, view_id: ViewId) -> set[str]:
|
|
675
|
+
"""Retrieve the set of read-only properties for a given view."""
|
|
676
|
+
|
|
677
|
+
readonly_properties: set[str] = set()
|
|
678
|
+
|
|
679
|
+
# Retrieve the view to check its properties
|
|
680
|
+
view = self._lookup_views([view_id]).get(view_id)
|
|
681
|
+
if view is None:
|
|
682
|
+
return readonly_properties
|
|
683
|
+
|
|
684
|
+
# Check each property in the view
|
|
685
|
+
for property_identifier, property in view.properties.items():
|
|
686
|
+
if isinstance(
|
|
687
|
+
property, MappedProperty
|
|
688
|
+
) and property.container_property_identifier in constants.READONLY_CONTAINER_PROPERTIES.get(
|
|
689
|
+
property.container, set()
|
|
690
|
+
):
|
|
691
|
+
readonly_properties.add(property_identifier)
|
|
692
|
+
return readonly_properties
|
|
693
|
+
|
|
672
694
|
def topological_sort(self, view_ids: list[ViewId]) -> list[ViewId]:
|
|
673
695
|
"""Sorts the views in topological order based on their implements and through properties."""
|
|
674
696
|
view_by_ids = self._lookup_views(view_ids)
|
|
@@ -4,15 +4,18 @@ from typing import ClassVar
|
|
|
4
4
|
|
|
5
5
|
from cognite.client.data_classes.aggregations import Count
|
|
6
6
|
from cognite.client.data_classes.data_modeling import (
|
|
7
|
+
ContainerId,
|
|
7
8
|
ContainerList,
|
|
8
9
|
EdgeApply,
|
|
9
10
|
NodeApply,
|
|
10
11
|
SpaceList,
|
|
12
|
+
ViewId,
|
|
11
13
|
ViewList,
|
|
12
14
|
)
|
|
13
15
|
from cognite.client.data_classes.data_modeling.instances import Instance, InstanceApply
|
|
14
16
|
from cognite.client.utils._identifier import InstanceId
|
|
15
17
|
|
|
18
|
+
from cognite_toolkit._cdf_tk import constants
|
|
16
19
|
from cognite_toolkit._cdf_tk.client import ToolkitClient
|
|
17
20
|
from cognite_toolkit._cdf_tk.client.data_classes.instances import InstanceList
|
|
18
21
|
from cognite_toolkit._cdf_tk.cruds import ContainerCRUD, SpaceCRUD, ViewCRUD
|
|
@@ -54,10 +57,35 @@ class InstanceIO(
|
|
|
54
57
|
def __init__(self, client: ToolkitClient, remove_existing_version: bool = True) -> None:
|
|
55
58
|
super().__init__(client)
|
|
56
59
|
self._remove_existing_version = remove_existing_version
|
|
60
|
+
# Cache for view to read-only properties mapping
|
|
61
|
+
self._view_readonly_properties_cache: dict[ViewId, set[str]] = {}
|
|
62
|
+
self._view_crud = ViewCRUD.create_loader(self.client)
|
|
57
63
|
|
|
58
64
|
def as_id(self, item: Instance) -> str:
|
|
59
65
|
return f"{item.space}:{item.external_id}"
|
|
60
66
|
|
|
67
|
+
def _filter_readonly_properties(self, instance: InstanceApply) -> None:
|
|
68
|
+
"""
|
|
69
|
+
Filter out read-only properties from the instance.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
instance: The instance to filter readonly properties from
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
for source in instance.sources:
|
|
76
|
+
readonly_properties = set()
|
|
77
|
+
if isinstance(source.source, ViewId):
|
|
78
|
+
if source.source not in self._view_readonly_properties_cache:
|
|
79
|
+
self._view_readonly_properties_cache[source.source] = self._view_crud.get_readonly_properties(
|
|
80
|
+
source.source
|
|
81
|
+
)
|
|
82
|
+
readonly_properties = self._view_readonly_properties_cache[source.source]
|
|
83
|
+
elif isinstance(source.source, ContainerId):
|
|
84
|
+
if source.source in constants.READONLY_CONTAINER_PROPERTIES:
|
|
85
|
+
readonly_properties = constants.READONLY_CONTAINER_PROPERTIES[source.source]
|
|
86
|
+
|
|
87
|
+
source.properties = {k: v for k, v in source.properties.items() if k not in readonly_properties}
|
|
88
|
+
|
|
61
89
|
def stream_data(self, selector: InstanceSelector, limit: int | None = None) -> Iterable[Page]:
|
|
62
90
|
if isinstance(selector, InstanceViewSelector | InstanceSpaceSelector):
|
|
63
91
|
chunk = InstanceList([])
|
|
@@ -133,12 +161,16 @@ class InstanceIO(
|
|
|
133
161
|
item_to_load = dict(item_json)
|
|
134
162
|
if self._remove_existing_version and "existingVersion" in item_to_load:
|
|
135
163
|
del item_to_load["existingVersion"]
|
|
164
|
+
instance: InstanceApply
|
|
136
165
|
if instance_type == "node":
|
|
137
|
-
|
|
166
|
+
instance = NodeApply._load(item_to_load, cognite_client=self.client)
|
|
138
167
|
elif instance_type == "edge":
|
|
139
|
-
|
|
168
|
+
instance = EdgeApply._load(item_to_load, cognite_client=self.client)
|
|
140
169
|
else:
|
|
141
170
|
raise ValueError(f"Unknown instance type {instance_type!r}")
|
|
171
|
+
# Filter out read-only properties if applicable
|
|
172
|
+
self._filter_readonly_properties(instance)
|
|
173
|
+
return instance
|
|
142
174
|
|
|
143
175
|
def configurations(self, selector: InstanceSelector) -> Iterable[StorageIOConfig]:
|
|
144
176
|
if not isinstance(selector, InstanceViewSelector | InstanceSpaceSelector):
|
|
@@ -4,7 +4,7 @@ default_env = "<DEFAULT_ENV_PLACEHOLDER>"
|
|
|
4
4
|
[modules]
|
|
5
5
|
# This is the version of the modules. It should not be changed manually.
|
|
6
6
|
# It will be updated by the 'cdf modules upgrade' command.
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.100"
|
|
8
8
|
|
|
9
9
|
[alpha_flags]
|
|
10
10
|
external-libraries = true
|
cognite_toolkit/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.6.
|
|
1
|
+
__version__ = "0.6.100"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cognite_toolkit
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.100
|
|
4
4
|
Summary: Official Cognite Data Fusion tool for project templates and configuration deployment
|
|
5
5
|
Project-URL: Homepage, https://docs.cognite.com/cdf/deploy/cdf_toolkit/
|
|
6
6
|
Project-URL: Changelog, https://github.com/cognitedata/toolkit/releases
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
cognite_toolkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
cognite_toolkit/_cdf.py,sha256=0abeQr1Tfk4lkGaoXyrnFC28wDSlR_8UGrh10noGduQ,6085
|
|
3
|
-
cognite_toolkit/_version.py,sha256=
|
|
3
|
+
cognite_toolkit/_version.py,sha256=ekvOvO7R8u7LJae-lLU38Td7TUQhHP94nO7w9IGZPxk,24
|
|
4
4
|
cognite_toolkit/_cdf_tk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
cognite_toolkit/_cdf_tk/cdf_toml.py,sha256=IjmzNVLxsOV6tsMDgmJmXsy-LQru-8IEQdFzGW5DxVk,8117
|
|
6
|
-
cognite_toolkit/_cdf_tk/constants.py,sha256=
|
|
6
|
+
cognite_toolkit/_cdf_tk/constants.py,sha256=Z0nsRXBrqVUgalMa7MZFiwPp26KUfaHqX2h89Daox-M,6936
|
|
7
7
|
cognite_toolkit/_cdf_tk/exceptions.py,sha256=xG0jMwi5A20nvPvyo6sCyz_cyKycynPyIzpYiGR4gcU,6064
|
|
8
8
|
cognite_toolkit/_cdf_tk/feature_flags.py,sha256=XMIZIOjPCdnH42SupUOETf_0d11TgKPZSfjCKnLoDJo,3017
|
|
9
9
|
cognite_toolkit/_cdf_tk/hints.py,sha256=UI1ymi2T5wCcYOpEbKbVaDnlyFReFy8TDtMVt-5E1h8,6493
|
|
@@ -146,7 +146,7 @@ cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py,sha256=iGG2_btpEqip3o6OKpc
|
|
|
146
146
|
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py,sha256=7RdiWvh6MLI1lLmt3gcqDQj61xbwREhsvoyjFuJn2F0,26402
|
|
147
147
|
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/configuration.py,sha256=KrL7bj8q5q18mGB2V-NDkW5U5nfseZOyorXiUbp2uLw,6100
|
|
148
148
|
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/data_organization.py,sha256=iXn9iAtwA8mhH-7j9GF-MlLomTcaw3GhEbFY28Wx0iA,9927
|
|
149
|
-
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py,sha256=
|
|
149
|
+
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py,sha256=ZmhfUn-h1UNI1iq1u5193cVOY4J6sbnwX1-h73rI4Gs,57999
|
|
150
150
|
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py,sha256=zv36HPO9goRmU3NM_i1wOvWQEdsgpQTI4bcAl-eis1g,18232
|
|
151
151
|
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/fieldops.py,sha256=SnQMbxiZ3SSYkTLXQ_vIu2HVf_WyD1jplNRJuoeOUfA,16723
|
|
152
152
|
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/file.py,sha256=F3n2FOWAPder4z3OTYs81VB-6C6r3oUzJsHvigdhaD0,15500
|
|
@@ -243,7 +243,7 @@ cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=DbTvIneN8Hw3ByhdH1kXk
|
|
|
243
243
|
cognite_toolkit/_cdf_tk/storageio/_base.py,sha256=6f4akYlaOp8t22ecb8ZEt1rcBU58oD-iPm8UdwLdPuE,11716
|
|
244
244
|
cognite_toolkit/_cdf_tk/storageio/_data_classes.py,sha256=s3TH04BJ1q7rXndRhEbVMEnoOXjxrGg4n-w9Z5uUL-o,3480
|
|
245
245
|
cognite_toolkit/_cdf_tk/storageio/_datapoints.py,sha256=nV8jaF5YLvMKhDPU3euf554GvSmfNYkzC9ZvEF7kbP8,8660
|
|
246
|
-
cognite_toolkit/_cdf_tk/storageio/_instances.py,sha256=
|
|
246
|
+
cognite_toolkit/_cdf_tk/storageio/_instances.py,sha256=t9fNpHnT6kCk8LDoPj3qZXmHpyDbPF5BZ6pI8ziTyFw,10810
|
|
247
247
|
cognite_toolkit/_cdf_tk/storageio/_raw.py,sha256=5WjAFiVR0KKRhMqCy1IRy1TQFWj86D7nGu5WSFNLp6U,3869
|
|
248
248
|
cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py,sha256=KqbQDKKyjD8hndVjpIYSUWbEsvovxnGnvX_84bwZKfI,1629
|
|
249
249
|
cognite_toolkit/_cdf_tk/storageio/selectors/_asset_centric.py,sha256=7Iv_ccVX6Vzt3ZLFZ0Er3hN92iEsFTm9wgF-yermOWE,1467
|
|
@@ -298,13 +298,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
|
|
|
298
298
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
|
|
299
299
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
|
|
300
300
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
|
|
301
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=
|
|
302
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=
|
|
303
|
-
cognite_toolkit/_resources/cdf.toml,sha256=
|
|
301
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=ZSjCLtq-YGfXLGlYDhMoTprko1TS0GUgyVHfI-XKZU0,668
|
|
302
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=JEhWmIWt5epdl2W0tYzs36zf4vuLKGRvZi8VUIhbtos,2431
|
|
303
|
+
cognite_toolkit/_resources/cdf.toml,sha256=lXzqzzipk6tF1QZs0EGuStsZtZ6XtnvdRqajdYyiFj0,488
|
|
304
304
|
cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
|
|
305
305
|
cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
|
|
306
|
-
cognite_toolkit-0.6.
|
|
307
|
-
cognite_toolkit-0.6.
|
|
308
|
-
cognite_toolkit-0.6.
|
|
309
|
-
cognite_toolkit-0.6.
|
|
310
|
-
cognite_toolkit-0.6.
|
|
306
|
+
cognite_toolkit-0.6.100.dist-info/METADATA,sha256=xADLp5iATIpAXC7tjua-hh1yFmaTMRIsGS3FEML3hq8,4502
|
|
307
|
+
cognite_toolkit-0.6.100.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
308
|
+
cognite_toolkit-0.6.100.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
|
|
309
|
+
cognite_toolkit-0.6.100.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
|
|
310
|
+
cognite_toolkit-0.6.100.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|