cognite-toolkit 0.6.110__py3-none-any.whl → 0.6.111__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.
@@ -18,7 +18,7 @@ from cognite_toolkit._cdf_tk.commands._migrate.creators import (
18
18
  InstanceSpaceCreator,
19
19
  SourceSystemCreator,
20
20
  )
21
- from cognite_toolkit._cdf_tk.commands._migrate.data_mapper import AssetCentricMapper
21
+ from cognite_toolkit._cdf_tk.commands._migrate.data_mapper import AssetCentricMapper, ChartMapper
22
22
  from cognite_toolkit._cdf_tk.commands._migrate.migration_io import (
23
23
  AnnotationMigrationIO,
24
24
  AssetCentricMigrationIO,
@@ -28,12 +28,15 @@ from cognite_toolkit._cdf_tk.commands._migrate.selectors import (
28
28
  MigrateDataSetSelector,
29
29
  MigrationCSVFileSelector,
30
30
  )
31
+ from cognite_toolkit._cdf_tk.storageio import ChartIO
32
+ from cognite_toolkit._cdf_tk.storageio.selectors import ChartExternalIdSelector
31
33
  from cognite_toolkit._cdf_tk.utils.auth import EnvironmentVariables
32
34
  from cognite_toolkit._cdf_tk.utils.cli_args import parse_view_str
33
35
  from cognite_toolkit._cdf_tk.utils.interactive_select import (
34
36
  AssetInteractiveSelect,
35
37
  DataModelingSelect,
36
38
  FileMetadataInteractiveSelect,
39
+ InteractiveChartSelect,
37
40
  ResourceViewMappingInteractiveSelect,
38
41
  )
39
42
  from cognite_toolkit._cdf_tk.utils.useful_types import AssetCentricKind
@@ -54,6 +57,7 @@ class MigrateApp(typer.Typer):
54
57
  self.command("files")(self.files)
55
58
  self.command("annotations")(self.annotations)
56
59
  self.command("canvas")(self.canvas)
60
+ self.command("charts")(self.charts)
57
61
  # Uncomment when infield v2 config migration is ready
58
62
  # self.command("infield-configs")(self.infield_configs)
59
63
 
@@ -887,6 +891,68 @@ class MigrateApp(typer.Typer):
887
891
  )
888
892
  )
889
893
 
894
+ @staticmethod
895
+ def charts(
896
+ ctx: typer.Context,
897
+ external_id: Annotated[
898
+ list[str] | None,
899
+ typer.Argument(
900
+ help="The external ID of the Chart to migrate. If not provided, an interactive selection will be "
901
+ "performed to select the Charts to migrate."
902
+ ),
903
+ ] = None,
904
+ log_dir: Annotated[
905
+ Path,
906
+ typer.Option(
907
+ "--log-dir",
908
+ "-l",
909
+ help="Path to the directory where migration logs will be stored.",
910
+ ),
911
+ ] = Path(f"migration_logs_{TODAY}"),
912
+ dry_run: Annotated[
913
+ bool,
914
+ typer.Option(
915
+ "--dry-run",
916
+ "-d",
917
+ help="If set, the migration will not be executed, but only a report of "
918
+ "what would be done is printed. This is useful for checking that all time series referenced by the Charts "
919
+ "have been migrated to the new data modeling resources in CDF.",
920
+ ),
921
+ ] = False,
922
+ verbose: Annotated[
923
+ bool,
924
+ typer.Option(
925
+ "--verbose",
926
+ "-v",
927
+ help="Turn on to get more verbose output when running the command",
928
+ ),
929
+ ] = False,
930
+ ) -> None:
931
+ """Migrate Charts from time series references to data modeling in CDF.
932
+
933
+ This command expects that the CogniteMigration data model is already deployed, and that the Mapping view
934
+ is populated with the mapping from time series to the new data modeling resources.
935
+ """
936
+ client = EnvironmentVariables.create_from_environment().get_client()
937
+
938
+ selected_external_ids: list[str]
939
+ if external_id:
940
+ selected_external_ids = external_id
941
+ else:
942
+ selected_external_ids = InteractiveChartSelect(client).select_external_ids()
943
+
944
+ cmd = MigrationCommand()
945
+ cmd.run(
946
+ lambda: cmd.migrate(
947
+ selected=ChartExternalIdSelector(external_ids=tuple(selected_external_ids)),
948
+ data=ChartIO(client),
949
+ mapper=ChartMapper(client),
950
+ log_dir=log_dir,
951
+ dry_run=dry_run,
952
+ verbose=verbose,
953
+ )
954
+ )
955
+
890
956
  @staticmethod
891
957
  def infield_configs(
892
958
  ctx: typer.Context,
@@ -17,7 +17,11 @@ from cognite.client.data_classes.data_modeling import (
17
17
 
18
18
  from cognite_toolkit._cdf_tk.client import ToolkitClient
19
19
  from cognite_toolkit._cdf_tk.client.data_classes.charts import Chart, ChartWrite
20
- from cognite_toolkit._cdf_tk.client.data_classes.charts_data import ChartCoreTimeseries, ChartSource, ChartTimeseries
20
+ from cognite_toolkit._cdf_tk.client.data_classes.charts_data import (
21
+ ChartCoreTimeseries,
22
+ ChartSource,
23
+ ChartTimeseries,
24
+ )
21
25
  from cognite_toolkit._cdf_tk.client.data_classes.migration import ResourceViewMappingApply
22
26
  from cognite_toolkit._cdf_tk.commands._migrate.conversion import DirectRelationCache, asset_centric_to_dm
23
27
  from cognite_toolkit._cdf_tk.commands._migrate.data_classes import AssetCentricMapping
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.6.110
15
+ image: cognite/toolkit:0.6.111
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.110
13
+ image: cognite/toolkit:0.6.111
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.110"
7
+ version = "0.6.111"
8
8
 
9
9
  [alpha_flags]
10
10
  external-libraries = true
@@ -1 +1 @@
1
- __version__ = "0.6.110"
1
+ __version__ = "0.6.111"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.6.110
3
+ Version: 0.6.111
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=0abeQr1Tfk4lkGaoXyrnFC28wDSlR_8UGrh10noGduQ,6085
3
- cognite_toolkit/_version.py,sha256=r8GW0BNwRXUAwN3axagFdsMsJonpDcvGzFglYAFiRio,24
3
+ cognite_toolkit/_version.py,sha256=NevwEofnLhZ12P5BZn0dR6xj6Bpsupi8Qtmt9IxErps,24
4
4
  cognite_toolkit/_cdf_tk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  cognite_toolkit/_cdf_tk/cdf_toml.py,sha256=VSWV9h44HusWIaKpWgjrOMrc3hDoPTTXBXlp6-NOrIM,9079
6
6
  cognite_toolkit/_cdf_tk/constants.py,sha256=Gi7iGGzdUrOnBeIK6ix3XiBieHIwzLJO5BWjDI3a6l4,7082
@@ -19,7 +19,7 @@ cognite_toolkit/_cdf_tk/apps/_dev_app.py,sha256=q8DBr4BAK33AwsHW3gAWZWSjSaQRuCis
19
19
  cognite_toolkit/_cdf_tk/apps/_download_app.py,sha256=Io7mW3DhYpLiDrqJfThSQThHDWrXN9c8huu9zYd0u7E,19408
20
20
  cognite_toolkit/_cdf_tk/apps/_dump_app.py,sha256=Ec0aEqbKwCkxni09i06rfY31qZUyOVwbbvo7MHh4cf8,39056
21
21
  cognite_toolkit/_cdf_tk/apps/_landing_app.py,sha256=HxzSln3fJXs5NzulfQGUMropXcwMobUYpyePrCrQTQs,1502
22
- cognite_toolkit/_cdf_tk/apps/_migrate_app.py,sha256=JuzY1t5pkW94Dyygr-mT2lheluR7cL8AmD2MfaXhc8Y,37093
22
+ cognite_toolkit/_cdf_tk/apps/_migrate_app.py,sha256=g4S_53kbIgk57ziPLdRMuR6xUe434gkMqa69VmVm5Vg,39619
23
23
  cognite_toolkit/_cdf_tk/apps/_modules_app.py,sha256=95_H2zccRJl2mWn0oQ5mjCaEDnG63sPKOkB81IgWcIk,7637
24
24
  cognite_toolkit/_cdf_tk/apps/_profile_app.py,sha256=vSRJW54bEvIul8_4rOqyOYA7ztXx7TFOvZRZWZTxMbg,7007
25
25
  cognite_toolkit/_cdf_tk/apps/_purge.py,sha256=e8IgDK2Fib2u30l71Q2trbJ1az90zSLWr5TViTINmL0,15415
@@ -130,7 +130,7 @@ cognite_toolkit/_cdf_tk/commands/_migrate/command.py,sha256=jNoqqq81lbdfDTAQ5w2c
130
130
  cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py,sha256=Ew9JRYrd-Ol9G9csTzpnhXAgCFnX67MwDYOTsdJLP3E,16803
131
131
  cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=FTu7w3G8KyPY8pagG3KdPpOmpLcjehaAg2auEy6iM7A,9605
132
132
  cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py,sha256=_vMS_qAPj4yup1VnmmojPVigAZtyPQH7PM0Raby5tao,10619
133
- cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=Q4VZsOF7__xkbNsCbzzhu-1Q34kYrMks1sKUZCk6ItY,11731
133
+ cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=m3_vDxgLauzDjQmNwrhb_aK01rnuHeHxRg3UuNzCa34,11748
134
134
  cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py,sha256=i1eUsNX6Dueol9STIEwyksBnBsWUk13O8qHIjW964pM,7860
135
135
  cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py,sha256=ERn3qFrJFXdtXaMjHq3Gk7MxH03MGFk3FrtWCOBJQts,5544
136
136
  cognite_toolkit/_cdf_tk/commands/_migrate/issues.py,sha256=L2-kODPavEwcuhte7EXANK2-rH7reiq-uNqr-3ub-no,6575
@@ -300,13 +300,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
300
300
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
301
301
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
302
302
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
303
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=sajGLbABAzcw49Ppp9445f-X0UR7aaEHM8zyQqa8OK4,668
304
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=FN7MyRwPdPA03R2VccxMZiKv58wrE1zxTUyx-oaPs2M,2431
305
- cognite_toolkit/_resources/cdf.toml,sha256=fr1qQg8VjnRir6nN2fiK6dBQWp2GiKPKON-kM9XYktM,488
303
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=j2bliPdlY2xgHldAqcr_OSEKiZSVKGMX4oS9dcoZs_w,668
304
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=QJtArzdlftwi4PrscZB65SoVdlEb8PYlphgGtdpZngg,2431
305
+ cognite_toolkit/_resources/cdf.toml,sha256=PDCEi-s5gIci7hyxLXz32LAfopeX846qABycsTnu7XY,488
306
306
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
307
307
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
308
- cognite_toolkit-0.6.110.dist-info/METADATA,sha256=3NOWs5ZjtTei1p98UMZs-9QKy9clBW0aqa1rY0hIp_U,4502
309
- cognite_toolkit-0.6.110.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
310
- cognite_toolkit-0.6.110.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
311
- cognite_toolkit-0.6.110.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
312
- cognite_toolkit-0.6.110.dist-info/RECORD,,
308
+ cognite_toolkit-0.6.111.dist-info/METADATA,sha256=J-6VIqjpmDb17ugQ9ThtamiQmXgxtlVmz2tztmAYksE,4502
309
+ cognite_toolkit-0.6.111.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
310
+ cognite_toolkit-0.6.111.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
311
+ cognite_toolkit-0.6.111.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
312
+ cognite_toolkit-0.6.111.dist-info/RECORD,,