cognite-toolkit 0.7.36__py3-none-any.whl → 0.7.37__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.
@@ -9,6 +9,7 @@ from cognite.client.data_classes.data_modeling import (
9
9
  MappedProperty,
10
10
  NodeApply,
11
11
  NodeId,
12
+ ViewId,
12
13
  )
13
14
  from cognite.client.data_classes.data_modeling.instances import EdgeApply, NodeOrEdgeData, PropertyValueWrite
14
15
  from cognite.client.data_classes.data_modeling.views import ViewProperty
@@ -29,7 +30,7 @@ from cognite_toolkit._cdf_tk.utils.useful_types import (
29
30
  AssetCentricTypeExtended,
30
31
  )
31
32
 
32
- from .data_model import INSTANCE_SOURCE_VIEW_ID
33
+ from .data_model import COGNITE_MIGRATION_SPACE_ID, INSTANCE_SOURCE_VIEW_ID
33
34
  from .issues import ConversionIssue, FailedConversion, InvalidPropertyDataType
34
35
 
35
36
 
@@ -169,6 +170,7 @@ def asset_centric_to_dm(
169
170
  view_source: ResourceViewMappingApply,
170
171
  view_properties: dict[str, ViewProperty],
171
172
  direct_relation_cache: DirectRelationCache,
173
+ preferred_consumer_view: ViewId | None = None,
172
174
  ) -> tuple[NodeApply | EdgeApply | None, ConversionIssue]:
173
175
  """Convert an asset-centric resource to a data model instance.
174
176
 
@@ -178,6 +180,7 @@ def asset_centric_to_dm(
178
180
  view_source (ResourceViewMappingApply): The view source defining how to map the resource to the data model.
179
181
  view_properties (dict[str, ViewProperty]): The defined properties referenced in the view source mapping.
180
182
  direct_relation_cache (DirectRelationCache): Cache for direct relation references.
183
+ preferred_consumer_view (ViewId | None): The preferred consumer view for the instance.
181
184
 
182
185
  Returns:
183
186
  tuple[NodeApply | EdgeApply, ConversionIssue]: A tuple containing the converted NodeApply and any ConversionIssue encountered.
@@ -213,7 +216,10 @@ def asset_centric_to_dm(
213
216
  "id": id_,
214
217
  "dataSetId": data_set_id,
215
218
  "classicExternalId": external_id,
219
+ "resourceViewMapping": {"space": COGNITE_MIGRATION_SPACE_ID, "externalId": view_source.external_id},
216
220
  }
221
+ if preferred_consumer_view:
222
+ instance_source_properties["preferredConsumerViewId"] = preferred_consumer_view.dump()
217
223
  sources.append(NodeOrEdgeData(source=INSTANCE_SOURCE_VIEW_ID, properties=instance_source_properties))
218
224
 
219
225
  instance: NodeApply | EdgeApply
@@ -147,6 +147,7 @@ class AssetCentricMapper(
147
147
  view_source=view_source,
148
148
  view_properties=view_properties,
149
149
  direct_relation_cache=self._direct_relation_cache,
150
+ preferred_consumer_view=mapping.preferred_consumer_view,
150
151
  )
151
152
  if mapping.instance_id.space == MISSING_INSTANCE_SPACE:
152
153
  conversion_issue.missing_instance_space = f"Missing instance space for dataset ID {mapping.data_set_id!r}"
@@ -4,6 +4,7 @@ from cognite.client.data_classes.data_modeling.containers import BTreeIndex
4
4
  SPACE = dm.SpaceApply(
5
5
  "cognite_migration", description="Space for the asset-centric to data modeling migration", name="cdf_migration"
6
6
  )
7
+ COGNITE_MIGRATION_SPACE_ID = SPACE.space
7
8
 
8
9
  RESOURCE_VIEW_MAPPING = dm.ContainerApply(
9
10
  space=SPACE.space,
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.7.36
15
+ image: cognite/toolkit:0.7.37
16
16
  env:
17
17
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
18
18
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -10,7 +10,7 @@ jobs:
10
10
  environment: dev
11
11
  name: Deploy Dry Run
12
12
  container:
13
- image: cognite/toolkit:0.7.36
13
+ image: cognite/toolkit:0.7.37
14
14
  env:
15
15
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
16
16
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -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.7.36"
7
+ version = "0.7.37"
8
8
 
9
9
 
10
10
  [plugins]
@@ -1 +1 @@
1
- __version__ = "0.7.36"
1
+ __version__ = "0.7.37"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.7.36
3
+ Version: 0.7.37
4
4
  Summary: Official Cognite Data Fusion tool for project templates and configuration deployment
5
5
  Author: Cognite AS
6
6
  Author-email: Cognite AS <support@cognite.com>
@@ -104,11 +104,11 @@ cognite_toolkit/_cdf_tk/commands/_download.py,sha256=dVddH9t7oGx1kdQ3CCYYQb96Uxx
104
104
  cognite_toolkit/_cdf_tk/commands/_import_cmd.py,sha256=RkJ7RZI6zxe0_1xrPB-iJhCVchurmIAChilx0_XMR6k,11141
105
105
  cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py,sha256=8ki04tJGH1dHdF2NtVF4HyhaC0XDDS7onrH_nvd9KtE,153
106
106
  cognite_toolkit/_cdf_tk/commands/_migrate/command.py,sha256=l2P0Em05aEJvNZH4WkEIm-QfO3TAjG1rc_YxELuQIQM,14214
107
- cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py,sha256=VxoFLS0Xi9uviICShxHHXbUU_wliqNZL3PxD0qveOSU,16810
107
+ cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py,sha256=NTDt2bNL30r-iWtDmO95rxSkMeylcRveNh0kueKc1y8,17244
108
108
  cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=hQ9o_N2aY9nqHOKlwP7tI7mAYLCPkPLSJGe_QTwglWc,9612
109
109
  cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py,sha256=__o2JZ3GkD0uqtjjpumHJF8KLdqCFrbMZOoEQHAeOLo,11488
110
- cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=282o0zDiY5_zqMNTQApn5uaM73vgo_FuNnQo3sicq9Y,24366
111
- cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py,sha256=i1eUsNX6Dueol9STIEwyksBnBsWUk13O8qHIjW964pM,7860
110
+ cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=dQdRx7qN_-hi2ALIZUw1hTdYpPtoe8H9_VLWlioIFUQ,24435
111
+ cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py,sha256=0lRyDRJ8zo00OngwWagQgHQIaemK4eufW9kbWwZ9Yo0,7901
112
112
  cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py,sha256=HRh-VlVWbOLjQfP968lReYtZFptjUEa4JbbZxiw5Qy8,5551
113
113
  cognite_toolkit/_cdf_tk/commands/_migrate/issues.py,sha256=uEMI5azCpHWAvEauRY9ZvsvNO0_aaUpdNP7_nM7oBC4,7547
114
114
  cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py,sha256=7gD7uKOy8kPa9u9rvRcOnZsuLGTD0WhU8szKGQ3GDoM,26782
@@ -309,14 +309,14 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
309
309
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
310
310
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
311
311
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
312
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=ofqsT_RZbUsrih1RE9qrzOOQK72T9aM4HwIu5OOdM20,667
313
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=Lul-1240VOiishKOBBWDJua7KIEuJziNJXcpgz8mRgE,2430
314
- cognite_toolkit/_resources/cdf.toml,sha256=DIpC1r6ql-BAasLk7nvhpPLpQeykwAU-XYG57VF8-iQ,475
315
- cognite_toolkit/_version.py,sha256=s_fO2Pb37oajrH9N1MYPwjM5YVV5bZvqGHD_GGAAiec,23
312
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=gR79ZiFB7x_quDn8S-igX6EbQCfZ4IYAn45cMDXwTJk,667
313
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=uz0GAeWtszko22mn51Lfhfr06eCyNKQ1mR7khL8vf_I,2430
314
+ cognite_toolkit/_resources/cdf.toml,sha256=_J325j9yHa-mVFBqQG92BilrJF0G1pch62_QF8xV6lw,475
315
+ cognite_toolkit/_version.py,sha256=mPIDHZlXNkUSLVUQoS8PGMfQqLTaNHZjGCBlyAgA8IA,23
316
316
  cognite_toolkit/config.dev.yaml,sha256=M33FiIKdS3XKif-9vXniQ444GTZ-bLXV8aFH86u9iUQ,332
317
317
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
318
318
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
319
- cognite_toolkit-0.7.36.dist-info/WHEEL,sha256=xDCZ-UyfvkGuEHPeI7BcJzYKIZzdqN8A8o1M5Om8IyA,79
320
- cognite_toolkit-0.7.36.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
321
- cognite_toolkit-0.7.36.dist-info/METADATA,sha256=IVa9xEH1DSyQh4n7Ipr0HyVjKHPLoZUAgI0hole3qjo,4507
322
- cognite_toolkit-0.7.36.dist-info/RECORD,,
319
+ cognite_toolkit-0.7.37.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
320
+ cognite_toolkit-0.7.37.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
321
+ cognite_toolkit-0.7.37.dist-info/METADATA,sha256=DqjU2cAuZCfxXxrfZNG3HvR2C2JZaV3QY5f6kTdowQw,4507
322
+ cognite_toolkit-0.7.37.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.17
2
+ Generator: uv 0.9.18
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any