cognite-toolkit 0.6.78__py3-none-any.whl → 0.6.79__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.

Potentially problematic release.


This version of cognite-toolkit might be problematic. Click here for more details.

@@ -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.78"
7
+ version = "0.6.79"
8
8
 
9
9
 
10
10
  [plugins]
@@ -8,13 +8,13 @@ from cognite.client.data_classes.data_modeling import ContainerId
8
8
 
9
9
  from cognite_toolkit._cdf_tk.client import ToolkitClient
10
10
  from cognite_toolkit._cdf_tk.commands import (
11
- MigrateFilesCommand,
12
11
  MigrationCanvasCommand,
13
12
  MigrationPrepareCommand,
14
13
  )
15
14
  from cognite_toolkit._cdf_tk.commands._migrate import MigrationCommand
16
15
  from cognite_toolkit._cdf_tk.commands._migrate.adapter import (
17
16
  AssetCentricMigrationIOAdapter,
17
+ FileMetaIOAdapter,
18
18
  MigrateDataSetSelector,
19
19
  MigrationCSVFileSelector,
20
20
  MigrationSelector,
@@ -581,11 +581,12 @@ class MigrateApp(typer.Typer):
581
581
  )
582
582
  )
583
583
 
584
- @staticmethod
584
+ @classmethod
585
585
  def files(
586
+ cls,
586
587
  ctx: typer.Context,
587
588
  mapping_file: Annotated[
588
- Path,
589
+ Path | None,
589
590
  typer.Option(
590
591
  "--mapping-file",
591
592
  "-m",
@@ -593,7 +594,51 @@ class MigrateApp(typer.Typer):
593
594
  "This file is expected to have the following columns: [id, dataSetId, space, externalId]."
594
595
  "The dataSetId is optional, and can be skipped. If it is set, it is used to check the access to the dataset.",
595
596
  ),
596
- ],
597
+ ] = None,
598
+ data_set_id: Annotated[
599
+ str | None,
600
+ typer.Option(
601
+ "--data-set-id",
602
+ "-s",
603
+ help="The data set ID to select for the files to migrate. If not provided, the dataSetId from the mapping file is used. "
604
+ "If neither is provided, the default data set for the project is used.",
605
+ ),
606
+ ] = None,
607
+ ingestion_mapping: Annotated[
608
+ str | None,
609
+ typer.Option(
610
+ "--ingestion-mapping",
611
+ "-i",
612
+ help="The ingestion mapping to use for the migrated files. If not provided, "
613
+ "the default mapping to CogniteFile in CogniteCore will be used.",
614
+ ),
615
+ ] = None,
616
+ consumption_view: Annotated[
617
+ str | None,
618
+ typer.Option(
619
+ "--consumption-view",
620
+ "-c",
621
+ help="The consumption view to assign to the migrated files Given as space:externalId/version. "
622
+ "This will be used in Canvas to select which view to use when migrating timeseries. If not provided, "
623
+ "CogniteFile in CogniteCore will be used.",
624
+ ),
625
+ ] = None,
626
+ log_dir: Annotated[
627
+ Path,
628
+ typer.Option(
629
+ "--log-dir",
630
+ "-l",
631
+ help="Path to the directory where logs will be stored. If the directory does not exist, it will be created.",
632
+ ),
633
+ ] = Path(f"migration_logs_{TODAY!s}"),
634
+ skip_linking: Annotated[
635
+ bool,
636
+ typer.Option(
637
+ "--skip-linking",
638
+ "-x",
639
+ help="If set, the migration will not create links between the old FileMetadata and the new CogniteFile.",
640
+ ),
641
+ ] = False,
597
642
  dry_run: Annotated[
598
643
  bool,
599
644
  typer.Option(
@@ -612,13 +657,33 @@ class MigrateApp(typer.Typer):
612
657
  ] = False,
613
658
  ) -> None:
614
659
  """Migrate Files to CogniteFiles."""
615
-
616
660
  client = EnvironmentVariables.create_from_environment().get_client(enable_set_pending_ids=True)
617
- cmd = MigrateFilesCommand()
661
+
662
+ selected, dry_run, verbose = cls._prepare_asset_centric_arguments(
663
+ client=client,
664
+ mapping_file=mapping_file,
665
+ data_set_id=data_set_id,
666
+ consumption_view=consumption_view,
667
+ ingestion_mapping=ingestion_mapping,
668
+ dry_run=dry_run,
669
+ verbose=verbose,
670
+ kind="FileMetadata",
671
+ resource_type="file",
672
+ container_id=ContainerId("cdf_cdm", "CogniteFile"),
673
+ )
674
+ cmd = MigrationCommand()
675
+
676
+ if data_set_id is None:
677
+ skip_linking = not questionary.confirm(
678
+ "Do you want to link old and new Files?", default=not skip_linking
679
+ ).ask()
680
+
618
681
  cmd.run(
619
- lambda: cmd.migrate_files(
620
- client,
621
- mapping_file=mapping_file,
682
+ lambda: cmd.migrate(
683
+ selected=selected,
684
+ data=FileMetaIOAdapter(client, skip_linking=skip_linking),
685
+ mapper=AssetCentricMapper(client),
686
+ log_dir=log_dir,
622
687
  dry_run=dry_run,
623
688
  verbose=verbose,
624
689
  )
@@ -326,7 +326,7 @@ class LinkingAdapter(
326
326
  return results
327
327
 
328
328
 
329
- class FileMetaAdapter(
329
+ class FileMetaIOAdapter(
330
330
  LinkingAdapter[
331
331
  str,
332
332
  FileMetadataWrite,
@@ -32,6 +32,7 @@ def create_default_mappings() -> list[ResourceViewMappingApply]:
32
32
  "labels": "tags",
33
33
  "mimeType": "mimeType",
34
34
  "directory": "directory",
35
+ "assetIds": "assets",
35
36
  "sourceCreatedTime": "sourceCreatedTime",
36
37
  "sourceModifiedTime": "sourceUpdatedTime",
37
38
  }
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.6.78
15
+ image: cognite/toolkit:0.6.79
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.78
13
+ image: cognite/toolkit:0.6.79
14
14
  env:
15
15
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
16
16
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -1 +1 @@
1
- __version__ = "0.6.78"
1
+ __version__ = "0.6.79"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.6.78
3
+ Version: 0.6.79
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=Lbv1moBfndOXDazAoDao6ZtDHqiN6L7Nv8sj8w6dkTE,5941
3
- cognite_toolkit/_version.py,sha256=CsBJy00_X3h-8DAU3fkhHtVkiF8payXogeGpwkSdK3c,23
3
+ cognite_toolkit/_version.py,sha256=LwNDLmfO-2-d9ejGMyparcS52Lej3rOsbuOvuFDbBaM,23
4
4
  cognite_toolkit/_builtin_modules/README.md,sha256=roU3G05E6ogP5yhw4hdIvVDKV831zCh2pzt9BVddtBg,307
5
5
  cognite_toolkit/_builtin_modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- cognite_toolkit/_builtin_modules/cdf.toml,sha256=xrW2OhstP4kDedUy5gzuPGqzgnTOYQpusWKDMrcey0E,273
6
+ cognite_toolkit/_builtin_modules/cdf.toml,sha256=1VS9GTUQqLILK3sscFjExe0fw2fVuzWvGB3pGAhgvC0,273
7
7
  cognite_toolkit/_builtin_modules/packages.toml,sha256=-z_dCOcZwhW86GV6SCB__XzKSQfZcAupGO7JoNB0TZQ,2735
8
8
  cognite_toolkit/_builtin_modules/bootcamp/README.md,sha256=iTVqoy3PLpC-xPi5pbuMIAEHILBSfWTGLexwa1AltpY,211
9
9
  cognite_toolkit/_builtin_modules/bootcamp/default.config.yaml,sha256=cBKReVJt2ZqFf5nBJl6mod_yo8iqSpXqh_7MQxi692U,94
@@ -494,7 +494,7 @@ cognite_toolkit/_cdf_tk/apps/_data_app.py,sha256=rFnTcUBAuoFcTQCjxwqZGG0HjUMGdYT
494
494
  cognite_toolkit/_cdf_tk/apps/_download_app.py,sha256=faAuhFYn7eQ_uzP3BNmnXeaeeoyZR1JvRZx2ATKrsao,16691
495
495
  cognite_toolkit/_cdf_tk/apps/_dump_app.py,sha256=Ec0aEqbKwCkxni09i06rfY31qZUyOVwbbvo7MHh4cf8,39056
496
496
  cognite_toolkit/_cdf_tk/apps/_landing_app.py,sha256=tV8hpqxLm2YgqB-TWieheK7ucN-JhQVtN13V3Zth6Os,386
497
- cognite_toolkit/_cdf_tk/apps/_migrate_app.py,sha256=BakIZ54DPdQQ7Cj0lp9mdqwGBhijaivs54kAr6CwIQ0,26399
497
+ cognite_toolkit/_cdf_tk/apps/_migrate_app.py,sha256=68jVGqtShpohcohgZnOPp1qg2nO99DignpBVhcvvInE,29030
498
498
  cognite_toolkit/_cdf_tk/apps/_modules_app.py,sha256=Ydjho3z89YCT7Jeq1sOg2rRkLffWH81KTYeWp8SW__Y,6623
499
499
  cognite_toolkit/_cdf_tk/apps/_populate_app.py,sha256=CDQup8xVGbTUR_G9O0phLVhz8GyRPM3quyFesdhnxY4,2783
500
500
  cognite_toolkit/_cdf_tk/apps/_profile_app.py,sha256=vSRJW54bEvIul8_4rOqyOYA7ztXx7TFOvZRZWZTxMbg,7007
@@ -594,7 +594,7 @@ cognite_toolkit/_cdf_tk/commands/pull.py,sha256=2Zf6IOXxSxZ-5XkNE80FlrXBuNejAWrA
594
594
  cognite_toolkit/_cdf_tk/commands/repo.py,sha256=MNy8MWphTklIZHvQOROCweq8_SYxGv6BaqnLpkFFnuk,3845
595
595
  cognite_toolkit/_cdf_tk/commands/run.py,sha256=JyX9jLEQej9eRrHVCCNlw4GuF80qETSol3-T5CCofgw,37331
596
596
  cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py,sha256=ODut2BHBKAMSQMane2S7v-3Z8EjJ67ab2k99zRASpvY,373
597
- cognite_toolkit/_cdf_tk/commands/_migrate/adapter.py,sha256=XravqmR0Dp_QgaeHCvczEzTnVFCpXo1DvR27ejnJG3I,14356
597
+ cognite_toolkit/_cdf_tk/commands/_migrate/adapter.py,sha256=l1mbV8LSRQyjof_U7QuxDtPYbsBn0-1LJjn0F5vdYfo,14358
598
598
  cognite_toolkit/_cdf_tk/commands/_migrate/assets.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
599
599
  cognite_toolkit/_cdf_tk/commands/_migrate/base.py,sha256=aS32Wa-gd7vFNOdCTKEIpSSdjQKZ8jblzD6c3YcOmzA,4942
600
600
  cognite_toolkit/_cdf_tk/commands/_migrate/canvas.py,sha256=Tv4OG9V6tDsQbSH13YW8M0n8Ury5gU16oJB-OISVR0w,6398
@@ -604,7 +604,7 @@ cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=PlDypLBxRDDwCNk9baL
604
604
  cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py,sha256=fQy-N1Jc3wjxj84mxRbQHSVGkefJGlyw1_Ll9NCuPSM,7237
605
605
  cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=TXqXgT_XcWwCB8yViEHNFOWjIdXr-EDHuJKOOf2smWs,5915
606
606
  cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py,sha256=i1eUsNX6Dueol9STIEwyksBnBsWUk13O8qHIjW964pM,7860
607
- cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py,sha256=QWR_WZE96rWmuL9us-6vga6oiMila7SPuJwkjAQY2gE,5517
607
+ cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py,sha256=KkSq_4R6hQ15ccG-jHy7vVgPwC5IDd5OaXZLvz5mIZs,5547
608
608
  cognite_toolkit/_cdf_tk/commands/_migrate/files.py,sha256=uDGNwTnlpc0cjwLX7P9GHcqf4IsD5Q9_4w7rUOpGWWU,6790
609
609
  cognite_toolkit/_cdf_tk/commands/_migrate/issues.py,sha256=lWSnuS3CfRDbA7i1g12gJ2reJnQcLmZWxHDK19-Wxkk,5772
610
610
  cognite_toolkit/_cdf_tk/commands/_migrate/prepare.py,sha256=sTxeEgIp2xNJXW-RoOhtdAXlww5Wxe94GyzZG1RyYW4,2483
@@ -765,12 +765,12 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
765
765
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
766
766
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
767
767
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
768
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=GNCA1X5TNm6U2Uq6WqxEGotEn5r5jEUZIe3jlfbbFSY,667
769
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=7QRn6XMfRQyGE3ykBe9E1AmhcqAYxL76DDMjQp1d-5s,2430
768
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=biC0TeyQtp-3sRMCN2JJ3PtNsgeSYMJBTi3uI_71YyY,667
769
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=PkVSZUv0ATqVoI6uNjeqENt-pstThjKTpE1k8MLRXu8,2430
770
770
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
771
771
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
772
- cognite_toolkit-0.6.78.dist-info/METADATA,sha256=B-2qyoZEjPI3V15Ikfdi8MJHTw6m9jEgr4EGcEaJ7ic,4501
773
- cognite_toolkit-0.6.78.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
774
- cognite_toolkit-0.6.78.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
775
- cognite_toolkit-0.6.78.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
776
- cognite_toolkit-0.6.78.dist-info/RECORD,,
772
+ cognite_toolkit-0.6.79.dist-info/METADATA,sha256=5kcS_-BqYNoz-0_WovD9HbD48sKG7Nl8HHqj5aiwHEI,4501
773
+ cognite_toolkit-0.6.79.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
774
+ cognite_toolkit-0.6.79.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
775
+ cognite_toolkit-0.6.79.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
776
+ cognite_toolkit-0.6.79.dist-info/RECORD,,