cognite-toolkit 0.6.91__py3-none-any.whl → 0.6.92__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.
@@ -6,6 +6,7 @@ from typing import Any, final
6
6
 
7
7
  import pandas as pd
8
8
  from cognite.client.data_classes import (
9
+ AggregateResultItem,
9
10
  Asset,
10
11
  AssetList,
11
12
  AssetWrite,
@@ -213,6 +214,20 @@ class AssetCRUD(ResourceCRUD[str, AssetWrite, Asset, AssetWriteList, AssetList])
213
214
  dumped.pop("metadata", None)
214
215
  if "parentId" in dumped and "parentId" not in local:
215
216
  dumped.pop("parentId")
217
+ if resource.aggregates:
218
+ # This is only included when the asset is downloaded/migrated with aggregated properties
219
+ aggregates = (
220
+ resource.aggregates.dump()
221
+ if isinstance(resource.aggregates, AggregateResultItem)
222
+ else resource.aggregates
223
+ )
224
+ if "path" in aggregates:
225
+ path = aggregates.pop("path", [])
226
+ if path:
227
+ aggregates["path"] = self.client.lookup.assets.external_id(
228
+ [segment["id"] for segment in path if "id" in segment]
229
+ )
230
+ dumped.update(aggregates)
216
231
  return dumped
217
232
 
218
233
 
@@ -4,6 +4,7 @@ from collections.abc import Iterable, MutableSequence, Sequence
4
4
  from typing import ClassVar, Generic
5
5
 
6
6
  from cognite.client.data_classes import (
7
+ AggregateResultItem,
7
8
  Asset,
8
9
  AssetList,
9
10
  AssetWrite,
@@ -267,6 +268,9 @@ class AssetIO(BaseAssetCentricIO[str, AssetWrite, Asset, AssetWriteList, AssetLi
267
268
  SchemaColumn(name="source", type="string"),
268
269
  SchemaColumn(name="labels", type="string", is_array=True),
269
270
  SchemaColumn(name="geoLocation", type="json"),
271
+ SchemaColumn(name="childCount", type="integer"),
272
+ SchemaColumn(name="depth", type="integer"),
273
+ SchemaColumn(name="path", type="string", is_array=True),
270
274
  ]
271
275
  return asset_schema + metadata_schema
272
276
 
@@ -277,6 +281,7 @@ class AssetIO(BaseAssetCentricIO[str, AssetWrite, Asset, AssetWriteList, AssetLi
277
281
  limit=limit,
278
282
  asset_subtree_external_ids=asset_subtree_external_ids,
279
283
  data_set_external_ids=data_set_external_ids,
284
+ aggregated_properties=["child_count", "path", "depth"],
280
285
  ):
281
286
  self._collect_dependencies(asset_list, selector)
282
287
  yield Page(worker_id="main", items=asset_list)
@@ -287,6 +292,14 @@ class AssetIO(BaseAssetCentricIO[str, AssetWrite, Asset, AssetWriteList, AssetLi
287
292
  # Ensure data sets are looked up to populate cache.
288
293
  # This is to avoid looking up each data set id individually in the .dump_resource call.
289
294
  self._populate_data_set_cache(data_chunk)
295
+ asset_ids = {
296
+ segment["id"]
297
+ for item in data_chunk
298
+ if isinstance(item.aggregates, AggregateResultItem)
299
+ for segment in item.aggregates.path or []
300
+ if "id" in segment
301
+ }
302
+ self.client.lookup.assets.external_id(list(asset_ids))
290
303
 
291
304
  return [self._crud.dump_resource(item) for item in data_chunk]
292
305
 
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.6.91
15
+ image: cognite/toolkit:0.6.92
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.6.91
13
+ image: cognite/toolkit:0.6.92
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.6.91"
7
+ version = "0.6.92"
8
8
 
9
9
  [alpha_flags]
10
10
  external-libraries = true
@@ -1 +1 @@
1
- __version__ = "0.6.91"
1
+ __version__ = "0.6.92"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.6.91
3
+ Version: 0.6.92
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,6 +1,6 @@
1
1
  cognite_toolkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  cognite_toolkit/_cdf.py,sha256=1OSAvbOeuIrnsczEG2BtGqRP3L3sq0VMPthmugnqCUw,5821
3
- cognite_toolkit/_version.py,sha256=9Ri169KKHyKxaZSidD_j90UcNV5T3e6F_wIJBgWZ0sY,23
3
+ cognite_toolkit/_version.py,sha256=YZ7t39hsVsYWfIrytObsq9bNDMC8cNjBCtEcAsIIKtA,23
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
6
  cognite_toolkit/_cdf_tk/constants.py,sha256=e9XmGvQCqGq7zYQrNoopU5e2KnYZYBPyUC5raGShK7k,6364
@@ -140,7 +140,7 @@ cognite_toolkit/_cdf_tk/cruds/_worker.py,sha256=XdLm6DMFln9DqDgEbeqzepw9WRSXx7Wd
140
140
  cognite_toolkit/_cdf_tk/cruds/_resource_cruds/__init__.py,sha256=ArtGm8mpf_akIAGMY_E6fyGpKQrMVJMkRZ3GEwCl8ig,2829
141
141
  cognite_toolkit/_cdf_tk/cruds/_resource_cruds/agent.py,sha256=2pcpwAJQ4GPvW2jM0J-Odm7d1sTlaaoBLKEXPHHz2VQ,5091
142
142
  cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py,sha256=iGG2_btpEqip3o6OKpcKfrh5IljOH9NbrJcGBKX0bn4,24971
143
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py,sha256=JIY5qC2mg3kV5zIMZRvUuTi3z7NM7gGbd3eiTN8nI8o,25716
143
+ cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py,sha256=7RdiWvh6MLI1lLmt3gcqDQj61xbwREhsvoyjFuJn2F0,26402
144
144
  cognite_toolkit/_cdf_tk/cruds/_resource_cruds/configuration.py,sha256=KrL7bj8q5q18mGB2V-NDkW5U5nfseZOyorXiUbp2uLw,6100
145
145
  cognite_toolkit/_cdf_tk/cruds/_resource_cruds/data_organization.py,sha256=iXn9iAtwA8mhH-7j9GF-MlLomTcaw3GhEbFY28Wx0iA,9927
146
146
  cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py,sha256=KED-wNXTZbkrK4bNMsJPnP1d0j8hF5apDUPgaKj52TY,57130
@@ -235,7 +235,7 @@ cognite_toolkit/_cdf_tk/resource_classes/robotics/map.py,sha256=j77z7CzCMiMj8r94
235
235
  cognite_toolkit/_cdf_tk/storageio/__init__.py,sha256=-OhPPhl9z1ynYcFlRVYfOPD246HhQydmn4VzByJh7C0,2355
236
236
  cognite_toolkit/_cdf_tk/storageio/_annotations.py,sha256=wAMkgM-IpgXuY7_1KbtiTv8VdA555ywKjntD_boOBPk,4647
237
237
  cognite_toolkit/_cdf_tk/storageio/_applications.py,sha256=bhyG1d2_9duPkX-otC2brVcpChvdXSPkYhBHS5T_72g,4343
238
- cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=Rhy64zUW4oxacq_vYomDeTRPmF6Vx-1mkYAFAqJE9vk,28312
238
+ cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=taxMxR2uBsCUsaproukSZxYEtly2sy2aZqPhI_-zhPA,28896
239
239
  cognite_toolkit/_cdf_tk/storageio/_base.py,sha256=NWXPdgzUnpBiav5Hi8XGHkWU9QiMjNzBQTxMcuxF-LA,11017
240
240
  cognite_toolkit/_cdf_tk/storageio/_data_classes.py,sha256=s3TH04BJ1q7rXndRhEbVMEnoOXjxrGg4n-w9Z5uUL-o,3480
241
241
  cognite_toolkit/_cdf_tk/storageio/_instances.py,sha256=_tKOdlo7tMJoh7y-47o7sySfDMRa-G-AFVprmzjn3EQ,9311
@@ -292,13 +292,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
292
292
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
293
293
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
294
294
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
295
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=b7kF2xhXglUAQbNX0QfAgjhzKgOcubmPTebEW2wxMtU,667
296
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=unYeq3F9O7KP6zW-P1XIwZMkXyXjyC_M7RMbA6VsR2w,2430
297
- cognite_toolkit/_resources/cdf.toml,sha256=1Nh-OE694YugqEwAeCM2CqDAvzxfnKen4vfmmPqbJCk,487
295
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=wEKwRNF7C9cq34yIaQjhQcIANNqWKVXwgESz25Mh8gs,667
296
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=mV6glTAupf2E-Cci5C56kOG6_bGjGzX29hEpcAX1pJo,2430
297
+ cognite_toolkit/_resources/cdf.toml,sha256=lvpWokDF_cDC9TVVer2bgMao9P--Hv0oJSpHl65OQ0Q,487
298
298
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
299
299
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
300
- cognite_toolkit-0.6.91.dist-info/METADATA,sha256=6Iti9CJTHQCwpGNr4zID5Y1uHhtVaj8RJ4ePoF0F-V8,4501
301
- cognite_toolkit-0.6.91.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
302
- cognite_toolkit-0.6.91.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
303
- cognite_toolkit-0.6.91.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
304
- cognite_toolkit-0.6.91.dist-info/RECORD,,
300
+ cognite_toolkit-0.6.92.dist-info/METADATA,sha256=urDOVGuS1ZjJwkVHotxDnAmMSLASTfKRwuy_1ymxEu0,4501
301
+ cognite_toolkit-0.6.92.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
302
+ cognite_toolkit-0.6.92.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
303
+ cognite_toolkit-0.6.92.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
304
+ cognite_toolkit-0.6.92.dist-info/RECORD,,