cognite-toolkit 0.6.78__py3-none-any.whl → 0.6.80__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.
- cognite_toolkit/_builtin_modules/cdf.toml +1 -1
- cognite_toolkit/_cdf.py +0 -4
- cognite_toolkit/_cdf_tk/apps/__init__.py +0 -2
- cognite_toolkit/_cdf_tk/apps/_migrate_app.py +134 -21
- cognite_toolkit/_cdf_tk/apps/_modules_app.py +27 -0
- cognite_toolkit/_cdf_tk/commands/__init__.py +0 -6
- cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py +0 -4
- cognite_toolkit/_cdf_tk/commands/_migrate/command.py +6 -8
- cognite_toolkit/_cdf_tk/commands/_migrate/creators.py +26 -2
- cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py +42 -8
- cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +4 -6
- cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py +1 -0
- cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py +203 -0
- cognite_toolkit/_cdf_tk/commands/_migrate/selectors.py +66 -0
- cognite_toolkit/_cdf_tk/commands/modules.py +59 -14
- cognite_toolkit/_cdf_tk/constants.py +3 -0
- cognite_toolkit/_cdf_tk/feature_flags.py +0 -4
- cognite_toolkit/_cdf_tk/storageio/_asset_centric.py +6 -6
- cognite_toolkit/_cdf_tk/storageio/_base.py +2 -5
- cognite_toolkit/_cdf_tk/utils/useful_types.py +3 -1
- 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 +13 -0
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.6.78.dist-info → cognite_toolkit-0.6.80.dist-info}/METADATA +1 -1
- {cognite_toolkit-0.6.78.dist-info → cognite_toolkit-0.6.80.dist-info}/RECORD +29 -32
- cognite_toolkit/_cdf_tk/apps/_populate_app.py +0 -80
- cognite_toolkit/_cdf_tk/commands/_migrate/adapter.py +0 -368
- cognite_toolkit/_cdf_tk/commands/_migrate/assets.py +0 -0
- cognite_toolkit/_cdf_tk/commands/_migrate/files.py +0 -165
- cognite_toolkit/_cdf_tk/commands/_migrate/timeseries.py +0 -165
- cognite_toolkit/_cdf_tk/commands/_populate.py +0 -306
- {cognite_toolkit-0.6.78.dist-info → cognite_toolkit-0.6.80.dist-info}/WHEEL +0 -0
- {cognite_toolkit-0.6.78.dist-info → cognite_toolkit-0.6.80.dist-info}/entry_points.txt +0 -0
- {cognite_toolkit-0.6.78.dist-info → cognite_toolkit-0.6.80.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
cognite_toolkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
cognite_toolkit/_cdf.py,sha256=
|
|
3
|
-
cognite_toolkit/_version.py,sha256=
|
|
2
|
+
cognite_toolkit/_cdf.py,sha256=1OSAvbOeuIrnsczEG2BtGqRP3L3sq0VMPthmugnqCUw,5821
|
|
3
|
+
cognite_toolkit/_version.py,sha256=fSZXLMUPcZFKVx9j8mdUsqfW3rMdWH1zhBr-b_DQ1sY,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=
|
|
6
|
+
cognite_toolkit/_builtin_modules/cdf.toml,sha256=AW2ErVYqg4fN_yQbAvSfqnvYN3fRY9vWcsXM-uRtkdg,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
|
|
@@ -480,23 +480,22 @@ cognite_toolkit/_builtin_modules/sourcesystem/cdf_sharepoint/workflows/trigger.W
|
|
|
480
480
|
cognite_toolkit/_builtin_modules/sourcesystem/cdf_sharepoint/workflows/v1.WorkflowVersion.yaml,sha256=YgGGZKlEro-ViFtOCU9RYVqnjflJjkCU_nBgmCE0SQk,322
|
|
481
481
|
cognite_toolkit/_cdf_tk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
482
482
|
cognite_toolkit/_cdf_tk/cdf_toml.py,sha256=DAUmHf19ByVIGH4MDPdXKHZ0G97CxdD5J-EzHTq66C8,8025
|
|
483
|
-
cognite_toolkit/_cdf_tk/constants.py,sha256=
|
|
483
|
+
cognite_toolkit/_cdf_tk/constants.py,sha256=AeGfm1UUDh-265YWNrHGUnvgZvLC4yzr923khZ3kQLo,6452
|
|
484
484
|
cognite_toolkit/_cdf_tk/exceptions.py,sha256=xG0jMwi5A20nvPvyo6sCyz_cyKycynPyIzpYiGR4gcU,6064
|
|
485
|
-
cognite_toolkit/_cdf_tk/feature_flags.py,sha256=
|
|
485
|
+
cognite_toolkit/_cdf_tk/feature_flags.py,sha256=oKvUHcNTtt8zp31eZ1eSCxfSIelm0L5B0xAQOskr1hc,2892
|
|
486
486
|
cognite_toolkit/_cdf_tk/hints.py,sha256=UI1ymi2T5wCcYOpEbKbVaDnlyFReFy8TDtMVt-5E1h8,6493
|
|
487
487
|
cognite_toolkit/_cdf_tk/plugins.py,sha256=yL7Q4k9UGnoHP9Ucrno02_qi1L3DrE6ggBiQI-wQKiU,783
|
|
488
488
|
cognite_toolkit/_cdf_tk/tracker.py,sha256=NNyaLcQ-E7fNjmeOejT7OALGZid27wTj8u-FcbEWxHk,6472
|
|
489
489
|
cognite_toolkit/_cdf_tk/validation.py,sha256=KFdPgnNIbVM0yjFF0cqmpBB8MI8e-U-YbBYrP4IiClE,8441
|
|
490
|
-
cognite_toolkit/_cdf_tk/apps/__init__.py,sha256=
|
|
490
|
+
cognite_toolkit/_cdf_tk/apps/__init__.py,sha256=nNQymHhwxjXNpY9N9xDmnvSPLCMwQkn_t9oRkgDWofI,659
|
|
491
491
|
cognite_toolkit/_cdf_tk/apps/_auth_app.py,sha256=ER7uYb3ViwsHMXiQEZpyhwU6TIjKaB9aEy32VI4MPpg,3397
|
|
492
492
|
cognite_toolkit/_cdf_tk/apps/_core_app.py,sha256=MwdS6sAx-HN_UdjXZIISmwlaXLamiP-rJssrCZGD5ng,13655
|
|
493
493
|
cognite_toolkit/_cdf_tk/apps/_data_app.py,sha256=rFnTcUBAuoFcTQCjxwqZGG0HjUMGdYTFyBGXxWg5gXE,824
|
|
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=
|
|
498
|
-
cognite_toolkit/_cdf_tk/apps/_modules_app.py,sha256=
|
|
499
|
-
cognite_toolkit/_cdf_tk/apps/_populate_app.py,sha256=CDQup8xVGbTUR_G9O0phLVhz8GyRPM3quyFesdhnxY4,2783
|
|
497
|
+
cognite_toolkit/_cdf_tk/apps/_migrate_app.py,sha256=xkXo1h3eQ14D5uQ0qQdq01etS1FV_fg6ZnvxMt8H-os,30580
|
|
498
|
+
cognite_toolkit/_cdf_tk/apps/_modules_app.py,sha256=95_H2zccRJl2mWn0oQ5mjCaEDnG63sPKOkB81IgWcIk,7637
|
|
500
499
|
cognite_toolkit/_cdf_tk/apps/_profile_app.py,sha256=vSRJW54bEvIul8_4rOqyOYA7ztXx7TFOvZRZWZTxMbg,7007
|
|
501
500
|
cognite_toolkit/_cdf_tk/apps/_purge.py,sha256=rhda9Sim9B9NXuRzCvIch1xTX1g8XlnZO0dRX7XAVZk,11756
|
|
502
501
|
cognite_toolkit/_cdf_tk/apps/_repo_app.py,sha256=jOf_s7oUWJqnRyz89JFiSzT2l8GlyQ7wqidHUQavGo0,1455
|
|
@@ -569,12 +568,11 @@ cognite_toolkit/_cdf_tk/client/data_classes/streamlit_.py,sha256=nEk00FH3i-px2r6
|
|
|
569
568
|
cognite_toolkit/_cdf_tk/client/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
570
569
|
cognite_toolkit/_cdf_tk/client/utils/_concurrency.py,sha256=3GtQbKDaosyKHEt-KzxKK9Yie4TvZPdoou2vUk6dUa8,2298
|
|
571
570
|
cognite_toolkit/_cdf_tk/client/utils/_http_client.py,sha256=oXNKrIaizG4WiSAhL_kSCHAuL4aaaEhCU4pOJGxh6Xs,483
|
|
572
|
-
cognite_toolkit/_cdf_tk/commands/__init__.py,sha256=
|
|
571
|
+
cognite_toolkit/_cdf_tk/commands/__init__.py,sha256=OJYtHiERtUBXm3cjUTyPVaYIMVQpu9HJv1QNGPL-AIQ,1418
|
|
573
572
|
cognite_toolkit/_cdf_tk/commands/_base.py,sha256=m2hnXo_AAHhsoSayHZO_zUa4xEt5w5oMB4WCHmJr-AY,2595
|
|
574
573
|
cognite_toolkit/_cdf_tk/commands/_changes.py,sha256=DIwuiRpDhWBDpsW3R3yqj0eWLAE3c_kPbmCaUkxjFuo,24852
|
|
575
574
|
cognite_toolkit/_cdf_tk/commands/_cli_commands.py,sha256=TK6U_rm6VZT_V941kTyHMoulWgJzbDC8YIIQDPJ5x3w,1011
|
|
576
575
|
cognite_toolkit/_cdf_tk/commands/_download.py,sha256=S5WuOAgbZTgU5kXyjqgTzm7e0hN9FI6IYOeQ9U-44Ow,6718
|
|
577
|
-
cognite_toolkit/_cdf_tk/commands/_populate.py,sha256=59VXEFRc4521xhTmCuQnjgWNYE3z4TUkUq8YbFREDGc,12280
|
|
578
576
|
cognite_toolkit/_cdf_tk/commands/_profile.py,sha256=_4iX3AHAI6eLmRVUlWXCSvVHx1BZW2yDr_i2i9ECg6U,43120
|
|
579
577
|
cognite_toolkit/_cdf_tk/commands/_purge.py,sha256=BEQvgk3z-Id3UaHyt_TL69ussv_ysZX3j1t6waJXE-c,37494
|
|
580
578
|
cognite_toolkit/_cdf_tk/commands/_upload.py,sha256=kXYmP1YMg-JvsuN1iYaMuZH1qZfapya2j-RABGhqGHo,11860
|
|
@@ -589,26 +587,24 @@ cognite_toolkit/_cdf_tk/commands/dump_data.py,sha256=8l4M2kqV4DjiV5js5s7EbFVNxV0
|
|
|
589
587
|
cognite_toolkit/_cdf_tk/commands/dump_resource.py,sha256=ylAFST3GgkWT1Qa-JIzmQXbrQgNCB1UrptrBf3WsyvY,39658
|
|
590
588
|
cognite_toolkit/_cdf_tk/commands/featureflag.py,sha256=lgLMwuNIwFjvvKn1sNMunkq4VTwdNqXtrZfdGFTrNcI,968
|
|
591
589
|
cognite_toolkit/_cdf_tk/commands/init.py,sha256=OuAVPI_tAJrwFO81EwzKXAA8m6ne44wXsJ0KZyKwPAE,239
|
|
592
|
-
cognite_toolkit/_cdf_tk/commands/modules.py,sha256=
|
|
590
|
+
cognite_toolkit/_cdf_tk/commands/modules.py,sha256=z-wauNjwsDwpFjCNZ2VF6NGkgcnz0_K8grR98XGO9Ls,42086
|
|
593
591
|
cognite_toolkit/_cdf_tk/commands/pull.py,sha256=2Zf6IOXxSxZ-5XkNE80FlrXBuNejAWrApAocu-kTrNw,39253
|
|
594
592
|
cognite_toolkit/_cdf_tk/commands/repo.py,sha256=MNy8MWphTklIZHvQOROCweq8_SYxGv6BaqnLpkFFnuk,3845
|
|
595
593
|
cognite_toolkit/_cdf_tk/commands/run.py,sha256=JyX9jLEQej9eRrHVCCNlw4GuF80qETSol3-T5CCofgw,37331
|
|
596
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py,sha256=
|
|
597
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/adapter.py,sha256=XravqmR0Dp_QgaeHCvczEzTnVFCpXo1DvR27ejnJG3I,14356
|
|
598
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/assets.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
594
|
+
cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py,sha256=i5ldcTah59K0E4fH5gHTV0GRvtDCEvVses9WQzn9Lno,226
|
|
599
595
|
cognite_toolkit/_cdf_tk/commands/_migrate/base.py,sha256=aS32Wa-gd7vFNOdCTKEIpSSdjQKZ8jblzD6c3YcOmzA,4942
|
|
600
596
|
cognite_toolkit/_cdf_tk/commands/_migrate/canvas.py,sha256=Tv4OG9V6tDsQbSH13YW8M0n8Ury5gU16oJB-OISVR0w,6398
|
|
601
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/command.py,sha256=
|
|
597
|
+
cognite_toolkit/_cdf_tk/commands/_migrate/command.py,sha256=RtC5CMQC1Wy5RmOwlCM67Mc8fZEExXubJLvzDzk2IMA,14097
|
|
602
598
|
cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py,sha256=Eol-0ruQ14fwS-bx2pEmbXdICodfknSJ_OsAASa6jkY,9592
|
|
603
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=
|
|
604
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py,sha256=
|
|
605
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=
|
|
599
|
+
cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=GMKwpJWH-yQmS9QUFcjKklI_9Ynxwp58R-vZlzJOBuI,9411
|
|
600
|
+
cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py,sha256=eF3Fv-tm_A8iaRUAOVOdg1DKPN7OYVPwrLQMvawsO14,8572
|
|
601
|
+
cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=L9HJGmcTiAkC8Sftrngp8FyHBtAbkZtb9HrpLFg-ED0,6006
|
|
606
602
|
cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py,sha256=i1eUsNX6Dueol9STIEwyksBnBsWUk13O8qHIjW964pM,7860
|
|
607
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py,sha256=
|
|
608
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/files.py,sha256=uDGNwTnlpc0cjwLX7P9GHcqf4IsD5Q9_4w7rUOpGWWU,6790
|
|
603
|
+
cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py,sha256=KkSq_4R6hQ15ccG-jHy7vVgPwC5IDd5OaXZLvz5mIZs,5547
|
|
609
604
|
cognite_toolkit/_cdf_tk/commands/_migrate/issues.py,sha256=lWSnuS3CfRDbA7i1g12gJ2reJnQcLmZWxHDK19-Wxkk,5772
|
|
605
|
+
cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py,sha256=J0Cb_TI_G5UoJIxpKGlCOLwjZ5VeDU93G_QP1-84lqU,9878
|
|
610
606
|
cognite_toolkit/_cdf_tk/commands/_migrate/prepare.py,sha256=sTxeEgIp2xNJXW-RoOhtdAXlww5Wxe94GyzZG1RyYW4,2483
|
|
611
|
-
cognite_toolkit/_cdf_tk/commands/_migrate/
|
|
607
|
+
cognite_toolkit/_cdf_tk/commands/_migrate/selectors.py,sha256=CYle1Gz69HHnKF4onTIFxrpiOoDApvVK01SFuQuHzP0,2130
|
|
612
608
|
cognite_toolkit/_cdf_tk/cruds/__init__.py,sha256=j0yxDCwd4Cl9KG7SvGTDQg4Y2bHfYVEDv8CBxbFTWUM,6070
|
|
613
609
|
cognite_toolkit/_cdf_tk/cruds/_base_cruds.py,sha256=L7JpH1e3XI7ZgH52zanCHVkO73r8zbe2sDLP83cIkY0,19651
|
|
614
610
|
cognite_toolkit/_cdf_tk/cruds/_data_cruds.py,sha256=3FYKow5uOBWt2-6kzszRJE8YgqxJQlp6WrvFsgwxyD4,9092
|
|
@@ -708,8 +704,8 @@ cognite_toolkit/_cdf_tk/resource_classes/robotics/location.py,sha256=dbc9HT-bc2Q
|
|
|
708
704
|
cognite_toolkit/_cdf_tk/resource_classes/robotics/map.py,sha256=j77z7CzCMiMj8r94BdUKCum9EuZRUjaSlUAy9K9DL_Q,942
|
|
709
705
|
cognite_toolkit/_cdf_tk/storageio/__init__.py,sha256=aM-skaPnKTH1B7HG0faeTUNf7u1b-sT8l7hh5JRZ1E8,2288
|
|
710
706
|
cognite_toolkit/_cdf_tk/storageio/_applications.py,sha256=bhyG1d2_9duPkX-otC2brVcpChvdXSPkYhBHS5T_72g,4343
|
|
711
|
-
cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=
|
|
712
|
-
cognite_toolkit/_cdf_tk/storageio/_base.py,sha256=
|
|
707
|
+
cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=0Q8htH7VM2mw0xx64R6lYrOLuLW8OJ4awO1kQgblh9E,23390
|
|
708
|
+
cognite_toolkit/_cdf_tk/storageio/_base.py,sha256=yqAaBlZcE53V_HKcKi_q-OjpC2Nnhkw13cbSvXjx2wY,8682
|
|
713
709
|
cognite_toolkit/_cdf_tk/storageio/_data_classes.py,sha256=s3TH04BJ1q7rXndRhEbVMEnoOXjxrGg4n-w9Z5uUL-o,3480
|
|
714
710
|
cognite_toolkit/_cdf_tk/storageio/_instances.py,sha256=_tKOdlo7tMJoh7y-47o7sySfDMRa-G-AFVprmzjn3EQ,9311
|
|
715
711
|
cognite_toolkit/_cdf_tk/storageio/_raw.py,sha256=5UkIk5MkyyCyGRYmyD6qTIsEDKbI2EulPesYbqM8qAA,3466
|
|
@@ -748,7 +744,7 @@ cognite_toolkit/_cdf_tk/utils/sql_parser.py,sha256=jernu2amPQ54cQZ4vFZm1gEhFZfGc
|
|
|
748
744
|
cognite_toolkit/_cdf_tk/utils/table_writers.py,sha256=Rxp_CZDDWrNPERNq6u1xsAX1OvzownwMMnpwNu8KdH0,17861
|
|
749
745
|
cognite_toolkit/_cdf_tk/utils/text.py,sha256=EpIXjaQ5C5q5fjbUjAW7tncXpdJfiQeV7CYSbr70Bl0,3106
|
|
750
746
|
cognite_toolkit/_cdf_tk/utils/thread_safe_dict.py,sha256=NbRHcZvWpF9xHP5OkOMGFpxrPNbi0Q3Eea6PUNbGlt4,3426
|
|
751
|
-
cognite_toolkit/_cdf_tk/utils/useful_types.py,sha256=
|
|
747
|
+
cognite_toolkit/_cdf_tk/utils/useful_types.py,sha256=tPZOcK1PR1hNogMCgF863APMK6p3528t5kKaKbVl0-s,1352
|
|
752
748
|
cognite_toolkit/_cdf_tk/utils/validate_access.py,sha256=uB_EdlrMDteOgpZDzcSutOjwp3u9jQ91Xl7uuqrBRh0,12427
|
|
753
749
|
cognite_toolkit/_cdf_tk/utils/fileio/__init__.py,sha256=_rZp6E2HaqixzPC57XQGaSm6xm1pFNXNJ4hBAnvGx1c,1137
|
|
754
750
|
cognite_toolkit/_cdf_tk/utils/fileio/_base.py,sha256=MpWaD3lR9vrJ-kGzTiDOtChXhvFD7-xrP-Pzp7vjnLY,756
|
|
@@ -765,12 +761,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
|
|
|
765
761
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
|
|
766
762
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
|
|
767
763
|
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=
|
|
769
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=
|
|
764
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=RP8LAIChX8hlvdhZ4w9SSu54n4PftJQMzwLPToJGE1s,667
|
|
765
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=TFgMyJmNh5rYnQlvI3MiIOlM7fQEdZgMPwIHTKXtWxI,2430
|
|
766
|
+
cognite_toolkit/_resources/cdf.toml,sha256=AW2ErVYqg4fN_yQbAvSfqnvYN3fRY9vWcsXM-uRtkdg,273
|
|
770
767
|
cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
|
|
771
768
|
cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
|
|
772
|
-
cognite_toolkit-0.6.
|
|
773
|
-
cognite_toolkit-0.6.
|
|
774
|
-
cognite_toolkit-0.6.
|
|
775
|
-
cognite_toolkit-0.6.
|
|
776
|
-
cognite_toolkit-0.6.
|
|
769
|
+
cognite_toolkit-0.6.80.dist-info/METADATA,sha256=8GLqmg4pwYBnS-eLsMp7eB3wUJFJ4hAbzfxYQHXyN1g,4501
|
|
770
|
+
cognite_toolkit-0.6.80.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
771
|
+
cognite_toolkit-0.6.80.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
|
|
772
|
+
cognite_toolkit-0.6.80.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
|
|
773
|
+
cognite_toolkit-0.6.80.dist-info/RECORD,,
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
from typing import Annotated, Any
|
|
3
|
-
|
|
4
|
-
import typer
|
|
5
|
-
from rich import print
|
|
6
|
-
|
|
7
|
-
from cognite_toolkit._cdf_tk.commands import PopulateCommand
|
|
8
|
-
from cognite_toolkit._cdf_tk.utils.auth import EnvironmentVariables
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class PopulateApp(typer.Typer):
|
|
12
|
-
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
13
|
-
super().__init__(*args, **kwargs)
|
|
14
|
-
self.callback(invoke_without_command=True)(self.main)
|
|
15
|
-
self.command("view")(self.populate_view)
|
|
16
|
-
|
|
17
|
-
def main(self, ctx: typer.Context) -> None:
|
|
18
|
-
"""Commands populate functionality"""
|
|
19
|
-
if ctx.invoked_subcommand is None:
|
|
20
|
-
print("Use [bold yellow]cdf populate --help[/] for more information.")
|
|
21
|
-
|
|
22
|
-
def populate_view(
|
|
23
|
-
self,
|
|
24
|
-
ctx: typer.Context,
|
|
25
|
-
view_id: Annotated[
|
|
26
|
-
list[str] | None,
|
|
27
|
-
typer.Argument(
|
|
28
|
-
help="View ID to populate. Format space external ID version, for example 'cdf_cdm CogniteAsset v1'"
|
|
29
|
-
" If not provided, interactive mode will be used.",
|
|
30
|
-
),
|
|
31
|
-
] = None,
|
|
32
|
-
table: Annotated[
|
|
33
|
-
Path | None,
|
|
34
|
-
typer.Option(
|
|
35
|
-
"--table",
|
|
36
|
-
"-t",
|
|
37
|
-
help="Path to the file containing the data to populate the view with. This is required unless interactive"
|
|
38
|
-
" mode is used",
|
|
39
|
-
),
|
|
40
|
-
] = None,
|
|
41
|
-
instance_space: Annotated[
|
|
42
|
-
str | None,
|
|
43
|
-
typer.Option(
|
|
44
|
-
"--space",
|
|
45
|
-
"-s",
|
|
46
|
-
help="The space to write the nodes to. This is required unless interactive mode is used",
|
|
47
|
-
),
|
|
48
|
-
] = None,
|
|
49
|
-
external_id_column: Annotated[
|
|
50
|
-
str | None,
|
|
51
|
-
typer.Option(
|
|
52
|
-
"--external-id-column",
|
|
53
|
-
"-e",
|
|
54
|
-
help="The name of the column in the table that contains the external IDs of the nodes. The column"
|
|
55
|
-
" must be present in the table and must contain unique values. This is required unless interactive"
|
|
56
|
-
" mode is used",
|
|
57
|
-
),
|
|
58
|
-
] = None,
|
|
59
|
-
verbose: Annotated[
|
|
60
|
-
bool,
|
|
61
|
-
typer.Option(
|
|
62
|
-
"--verbose",
|
|
63
|
-
"-v",
|
|
64
|
-
help="Turn on to get more verbose output when running the command",
|
|
65
|
-
),
|
|
66
|
-
] = False,
|
|
67
|
-
) -> None:
|
|
68
|
-
"""This command will populate a given view with data from a local table."""
|
|
69
|
-
cmd = PopulateCommand()
|
|
70
|
-
client = EnvironmentVariables.create_from_environment().get_client()
|
|
71
|
-
cmd.run(
|
|
72
|
-
lambda: cmd.view(
|
|
73
|
-
client,
|
|
74
|
-
view_id,
|
|
75
|
-
table,
|
|
76
|
-
instance_space,
|
|
77
|
-
external_id_column,
|
|
78
|
-
verbose,
|
|
79
|
-
)
|
|
80
|
-
)
|
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from collections.abc import Iterator, Sequence
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from functools import cached_property
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
from typing import ClassVar, Generic, Literal
|
|
7
|
-
|
|
8
|
-
from cognite.client.data_classes import (
|
|
9
|
-
FileMetadata,
|
|
10
|
-
FileMetadataList,
|
|
11
|
-
FileMetadataWrite,
|
|
12
|
-
FileMetadataWriteList,
|
|
13
|
-
TimeSeries,
|
|
14
|
-
TimeSeriesList,
|
|
15
|
-
TimeSeriesWrite,
|
|
16
|
-
TimeSeriesWriteList,
|
|
17
|
-
)
|
|
18
|
-
from cognite.client.data_classes._base import (
|
|
19
|
-
T_CogniteResourceList,
|
|
20
|
-
T_WritableCogniteResource,
|
|
21
|
-
T_WriteClass,
|
|
22
|
-
WriteableCogniteResource,
|
|
23
|
-
WriteableCogniteResourceList,
|
|
24
|
-
)
|
|
25
|
-
from cognite.client.data_classes.data_modeling import InstanceApply, NodeId, ViewId
|
|
26
|
-
|
|
27
|
-
from cognite_toolkit._cdf_tk.client import ToolkitClient
|
|
28
|
-
from cognite_toolkit._cdf_tk.client.data_classes.instances import InstanceApplyList
|
|
29
|
-
from cognite_toolkit._cdf_tk.client.data_classes.pending_instances_ids import PendingInstanceId
|
|
30
|
-
from cognite_toolkit._cdf_tk.constants import MISSING_INSTANCE_SPACE
|
|
31
|
-
from cognite_toolkit._cdf_tk.cruds._base_cruds import T_ID
|
|
32
|
-
from cognite_toolkit._cdf_tk.exceptions import ToolkitNotImplementedError
|
|
33
|
-
from cognite_toolkit._cdf_tk.storageio import (
|
|
34
|
-
BaseAssetCentricIO,
|
|
35
|
-
FileMetadataIO,
|
|
36
|
-
InstanceIO,
|
|
37
|
-
TimeSeriesIO,
|
|
38
|
-
UploadableStorageIO,
|
|
39
|
-
)
|
|
40
|
-
from cognite_toolkit._cdf_tk.storageio._base import Page, UploadItem
|
|
41
|
-
from cognite_toolkit._cdf_tk.storageio.selectors import (
|
|
42
|
-
DataSelector,
|
|
43
|
-
DataSetSelector,
|
|
44
|
-
)
|
|
45
|
-
from cognite_toolkit._cdf_tk.utils.collection import chunker_sequence
|
|
46
|
-
from cognite_toolkit._cdf_tk.utils.http_client import HTTPClient, HTTPMessage, ItemsRequest, SuccessResponseItems
|
|
47
|
-
from cognite_toolkit._cdf_tk.utils.useful_types import (
|
|
48
|
-
AssetCentricKind,
|
|
49
|
-
AssetCentricType,
|
|
50
|
-
JsonVal,
|
|
51
|
-
T_WritableCogniteResourceList,
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
from .data_classes import MigrationMapping, MigrationMappingList
|
|
55
|
-
from .data_model import INSTANCE_SOURCE_VIEW_ID
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
class MigrationSelector(DataSelector, ABC):
|
|
59
|
-
@abstractmethod
|
|
60
|
-
def get_ingestion_mappings(self) -> list[str]:
|
|
61
|
-
raise NotImplementedError()
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
class MigrationCSVFileSelector(MigrationSelector):
|
|
65
|
-
type: Literal["migrationCSVFile"] = "migrationCSVFile"
|
|
66
|
-
datafile: Path
|
|
67
|
-
|
|
68
|
-
@property
|
|
69
|
-
def group(self) -> str:
|
|
70
|
-
return f"Migration_{self.kind}"
|
|
71
|
-
|
|
72
|
-
def __str__(self) -> str:
|
|
73
|
-
return f"file_{self.datafile.name}"
|
|
74
|
-
|
|
75
|
-
def get_ingestion_mappings(self) -> list[str]:
|
|
76
|
-
views = {item.get_ingestion_view() for item in self.items}
|
|
77
|
-
return sorted(views)
|
|
78
|
-
|
|
79
|
-
@cached_property
|
|
80
|
-
def items(self) -> MigrationMappingList:
|
|
81
|
-
return MigrationMappingList.read_csv_file(self.datafile, resource_type=self.kind)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
class MigrateDataSetSelector(MigrationSelector):
|
|
85
|
-
type: Literal["migrateDataSet"] = "migrateDataSet"
|
|
86
|
-
kind: AssetCentricKind
|
|
87
|
-
data_set_external_id: str
|
|
88
|
-
ingestion_mapping: str | None = None
|
|
89
|
-
preferred_consumer_view: ViewId | None = None
|
|
90
|
-
|
|
91
|
-
@property
|
|
92
|
-
def group(self) -> str:
|
|
93
|
-
return f"DataSet_{self.data_set_external_id}"
|
|
94
|
-
|
|
95
|
-
def __str__(self) -> str:
|
|
96
|
-
return self.kind
|
|
97
|
-
|
|
98
|
-
def get_schema_spaces(self) -> list[str] | None:
|
|
99
|
-
return None
|
|
100
|
-
|
|
101
|
-
def get_instance_spaces(self) -> list[str] | None:
|
|
102
|
-
return None
|
|
103
|
-
|
|
104
|
-
def get_ingestion_mappings(self) -> list[str]:
|
|
105
|
-
return [self.ingestion_mapping] if self.ingestion_mapping else []
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
@dataclass
|
|
109
|
-
class AssetCentricMapping(Generic[T_WritableCogniteResource], WriteableCogniteResource[InstanceApply]):
|
|
110
|
-
mapping: MigrationMapping
|
|
111
|
-
resource: T_WritableCogniteResource
|
|
112
|
-
|
|
113
|
-
def as_write(self) -> InstanceApply:
|
|
114
|
-
raise NotImplementedError()
|
|
115
|
-
|
|
116
|
-
def dump(self, camel_case: bool = True) -> dict[str, JsonVal]:
|
|
117
|
-
mapping = self.mapping.model_dump(exclude_unset=True, by_alias=camel_case)
|
|
118
|
-
# Ensure that resource type is always included, even if unset.
|
|
119
|
-
mapping["resourceType" if camel_case else "resource_type"] = self.mapping.resource_type
|
|
120
|
-
return {
|
|
121
|
-
"mapping": mapping,
|
|
122
|
-
"resource": self.resource.dump(camel_case=camel_case),
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
class AssetCentricMappingList(
|
|
127
|
-
WriteableCogniteResourceList[InstanceApply, AssetCentricMapping[T_WritableCogniteResource]]
|
|
128
|
-
):
|
|
129
|
-
_RESOURCE: type = AssetCentricMapping
|
|
130
|
-
|
|
131
|
-
def as_write(self) -> InstanceApplyList:
|
|
132
|
-
return InstanceApplyList([item.as_write() for item in self])
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
class AssetCentricMigrationIOAdapter(
|
|
136
|
-
Generic[T_ID, T_WriteClass, T_WritableCogniteResource, T_CogniteResourceList, T_WritableCogniteResourceList],
|
|
137
|
-
UploadableStorageIO[MigrationSelector, AssetCentricMapping[T_WritableCogniteResource], InstanceApply],
|
|
138
|
-
):
|
|
139
|
-
KIND = "AssetCentricMigration"
|
|
140
|
-
SUPPORTED_DOWNLOAD_FORMATS = frozenset({".parquet", ".csv", ".ndjson"})
|
|
141
|
-
SUPPORTED_COMPRESSIONS = frozenset({".gz"})
|
|
142
|
-
SUPPORTED_READ_FORMATS = frozenset({".parquet", ".csv", ".ndjson", ".yaml", ".yml"})
|
|
143
|
-
CHUNK_SIZE = 1000
|
|
144
|
-
UPLOAD_ENDPOINT = InstanceIO.UPLOAD_ENDPOINT
|
|
145
|
-
|
|
146
|
-
def __init__(
|
|
147
|
-
self,
|
|
148
|
-
client: ToolkitClient,
|
|
149
|
-
base: BaseAssetCentricIO[
|
|
150
|
-
T_ID, T_WriteClass, T_WritableCogniteResource, T_CogniteResourceList, T_WritableCogniteResourceList
|
|
151
|
-
],
|
|
152
|
-
) -> None:
|
|
153
|
-
super().__init__(client)
|
|
154
|
-
self.base = base
|
|
155
|
-
|
|
156
|
-
def as_id(self, item: AssetCentricMapping) -> str:
|
|
157
|
-
return f"{item.mapping.resource_type}_{item.mapping.id}"
|
|
158
|
-
|
|
159
|
-
def stream_data(self, selector: MigrationSelector, limit: int | None = None) -> Iterator[Page]:
|
|
160
|
-
if isinstance(selector, MigrationCSVFileSelector):
|
|
161
|
-
iterator = self._stream_from_csv(selector, limit)
|
|
162
|
-
elif isinstance(selector, MigrateDataSetSelector):
|
|
163
|
-
iterator = self._stream_given_dataset(selector, limit)
|
|
164
|
-
else:
|
|
165
|
-
raise ToolkitNotImplementedError(f"Selector {type(selector)} is not supported for stream_data")
|
|
166
|
-
yield from (Page(worker_id="main", items=items) for items in iterator)
|
|
167
|
-
|
|
168
|
-
def _stream_from_csv(
|
|
169
|
-
self, selector: MigrationCSVFileSelector, limit: int | None = None
|
|
170
|
-
) -> Iterator[Sequence[AssetCentricMapping[T_WritableCogniteResource]]]:
|
|
171
|
-
items = selector.items
|
|
172
|
-
if limit is not None:
|
|
173
|
-
items = MigrationMappingList(items[:limit])
|
|
174
|
-
chunk: list[AssetCentricMapping[T_WritableCogniteResource]] = []
|
|
175
|
-
for current_batch in chunker_sequence(items, self.CHUNK_SIZE):
|
|
176
|
-
resources = self.base.retrieve(current_batch.get_ids())
|
|
177
|
-
for mapping, resource in zip(current_batch, resources, strict=True):
|
|
178
|
-
chunk.append(AssetCentricMapping(mapping=mapping, resource=resource))
|
|
179
|
-
if chunk:
|
|
180
|
-
yield chunk
|
|
181
|
-
chunk = []
|
|
182
|
-
|
|
183
|
-
def count(self, selector: MigrationSelector) -> int | None:
|
|
184
|
-
if isinstance(selector, MigrationCSVFileSelector):
|
|
185
|
-
return len(selector.items)
|
|
186
|
-
elif isinstance(selector, MigrateDataSetSelector):
|
|
187
|
-
asset_centric_selector = self._get_asset_centric_selector(selector)
|
|
188
|
-
return self.base.count(asset_centric_selector)
|
|
189
|
-
else:
|
|
190
|
-
raise ToolkitNotImplementedError(f"Selector {type(selector)} is not supported for count")
|
|
191
|
-
|
|
192
|
-
@staticmethod
|
|
193
|
-
def _get_asset_centric_selector(selector: MigrateDataSetSelector) -> DataSetSelector:
|
|
194
|
-
return DataSetSelector(
|
|
195
|
-
data_set_external_id=selector.data_set_external_id,
|
|
196
|
-
kind=selector.kind,
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
def _stream_given_dataset(
|
|
200
|
-
self, selector: MigrateDataSetSelector, limit: int | None = None
|
|
201
|
-
) -> Iterator[Sequence[AssetCentricMapping[T_WritableCogniteResource]]]:
|
|
202
|
-
asset_centric_selector = self._get_asset_centric_selector(selector)
|
|
203
|
-
for data_chunk in self.base.stream_data(asset_centric_selector, limit):
|
|
204
|
-
mapping_list = AssetCentricMappingList[T_WritableCogniteResource]([])
|
|
205
|
-
for resource in data_chunk.items:
|
|
206
|
-
space_source = self.client.migration.space_source.retrieve(data_set_id=resource.data_set_id)
|
|
207
|
-
instance_space = space_source.instance_space if space_source else None
|
|
208
|
-
if instance_space is None:
|
|
209
|
-
instance_space = MISSING_INSTANCE_SPACE
|
|
210
|
-
mapping = MigrationMapping(
|
|
211
|
-
resource_type=self._kind_to_resource_type(selector.kind),
|
|
212
|
-
instance_id=NodeId(
|
|
213
|
-
space=instance_space,
|
|
214
|
-
external_id=resource.external_id,
|
|
215
|
-
),
|
|
216
|
-
id=resource.id,
|
|
217
|
-
data_set_id=resource.data_set_id,
|
|
218
|
-
ingestion_view=selector.ingestion_mapping,
|
|
219
|
-
preferred_consumer_view=selector.preferred_consumer_view,
|
|
220
|
-
)
|
|
221
|
-
mapping_list.append(AssetCentricMapping(mapping=mapping, resource=resource))
|
|
222
|
-
yield mapping_list
|
|
223
|
-
|
|
224
|
-
@staticmethod
|
|
225
|
-
def _kind_to_resource_type(kind: AssetCentricKind) -> AssetCentricType:
|
|
226
|
-
mapping: dict[AssetCentricKind, AssetCentricType] = {
|
|
227
|
-
"Assets": "asset",
|
|
228
|
-
"Events": "event",
|
|
229
|
-
"TimeSeries": "timeseries",
|
|
230
|
-
"FileMetadata": "file",
|
|
231
|
-
}
|
|
232
|
-
try:
|
|
233
|
-
return mapping[kind]
|
|
234
|
-
except KeyError as e:
|
|
235
|
-
raise ToolkitNotImplementedError(f"Kind '{kind}' is not supported") from e
|
|
236
|
-
|
|
237
|
-
def data_to_json_chunk(
|
|
238
|
-
self,
|
|
239
|
-
data_chunk: Sequence[AssetCentricMapping[T_WritableCogniteResource]],
|
|
240
|
-
selector: MigrationSelector | None = None,
|
|
241
|
-
) -> list[dict[str, JsonVal]]:
|
|
242
|
-
return [item.dump() for item in data_chunk]
|
|
243
|
-
|
|
244
|
-
def json_to_resource(self, item_json: dict[str, JsonVal]) -> InstanceApply:
|
|
245
|
-
raise NotImplementedError()
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
class LinkingAdapter(
|
|
249
|
-
AssetCentricMigrationIOAdapter[
|
|
250
|
-
T_ID, T_WriteClass, T_WritableCogniteResource, T_CogniteResourceList, T_WritableCogniteResourceList
|
|
251
|
-
]
|
|
252
|
-
):
|
|
253
|
-
"""Adapter that links asset-centric resources to data model instances before uploading them.
|
|
254
|
-
|
|
255
|
-
This is necessary to link asset-centric resources to their new CogniteDataModel instances using the
|
|
256
|
-
appropriate set-pending-instance-ids endpoint.
|
|
257
|
-
|
|
258
|
-
Args:
|
|
259
|
-
client: ToolkitClient
|
|
260
|
-
The toolkit client to use for communication with CDF.
|
|
261
|
-
base: BaseAssetCentricIO
|
|
262
|
-
The base asset-centric IO to use for retrieving asset-centric resources.
|
|
263
|
-
skip_linking: bool
|
|
264
|
-
Whether to skip the linking step and only upload the resources. Essentially creating a copy.
|
|
265
|
-
|
|
266
|
-
"""
|
|
267
|
-
|
|
268
|
-
PENDING_INSTANCE_ID_ENDPOINT: ClassVar[str]
|
|
269
|
-
|
|
270
|
-
def __init__(
|
|
271
|
-
self,
|
|
272
|
-
client: ToolkitClient,
|
|
273
|
-
base: BaseAssetCentricIO[
|
|
274
|
-
T_ID, T_WriteClass, T_WritableCogniteResource, T_CogniteResourceList, T_WritableCogniteResourceList
|
|
275
|
-
],
|
|
276
|
-
skip_linking: bool = False,
|
|
277
|
-
) -> None:
|
|
278
|
-
super().__init__(client, base)
|
|
279
|
-
self.skip_linking = skip_linking
|
|
280
|
-
|
|
281
|
-
@staticmethod
|
|
282
|
-
def as_pending_instance_id(item: InstanceApply) -> PendingInstanceId:
|
|
283
|
-
"""Convert an InstanceApply to a PendingInstanceId for linking."""
|
|
284
|
-
source = next((source for source in item.sources if source.source == INSTANCE_SOURCE_VIEW_ID), None)
|
|
285
|
-
if source is None:
|
|
286
|
-
raise ValueError(f"Cannot extract ID from item of type {type(item).__name__!r}")
|
|
287
|
-
if not isinstance(source.properties["id"], int):
|
|
288
|
-
raise ValueError(f"Unexpected ID type: {type(source.properties['id']).__name__!r}")
|
|
289
|
-
id_ = source.properties["id"]
|
|
290
|
-
return PendingInstanceId(
|
|
291
|
-
pending_instance_id=NodeId(item.space, item.external_id),
|
|
292
|
-
id=id_,
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
def upload_items(
|
|
296
|
-
self,
|
|
297
|
-
data_chunk: Sequence[UploadItem[InstanceApply]],
|
|
298
|
-
http_client: HTTPClient,
|
|
299
|
-
selector: MigrationSelector | None = None,
|
|
300
|
-
) -> Sequence[HTTPMessage]:
|
|
301
|
-
"""Upload items by first linking them using files/set-pending-instance-ids and then uploading the instances."""
|
|
302
|
-
if self.skip_linking:
|
|
303
|
-
return list(super().upload_items(data_chunk, http_client, selector))
|
|
304
|
-
config = http_client.config
|
|
305
|
-
results: list[HTTPMessage] = []
|
|
306
|
-
successful_linked: set[str] = set()
|
|
307
|
-
for batch in chunker_sequence(data_chunk, self.CHUNK_SIZE):
|
|
308
|
-
batch_results = http_client.request_with_retries(
|
|
309
|
-
message=ItemsRequest(
|
|
310
|
-
endpoint_url=config.create_api_url(self.PENDING_INSTANCE_ID_ENDPOINT),
|
|
311
|
-
method="POST",
|
|
312
|
-
api_version="alpha",
|
|
313
|
-
items=[
|
|
314
|
-
UploadItem(source_id=item.source_id, item=self.as_pending_instance_id(item.item))
|
|
315
|
-
for item in batch
|
|
316
|
-
],
|
|
317
|
-
)
|
|
318
|
-
)
|
|
319
|
-
for res in batch_results:
|
|
320
|
-
if isinstance(res, SuccessResponseItems):
|
|
321
|
-
successful_linked.update(res.ids)
|
|
322
|
-
results.extend(batch_results)
|
|
323
|
-
to_upload = [item for item in data_chunk if item.source_id in successful_linked]
|
|
324
|
-
if to_upload:
|
|
325
|
-
results.extend(list(super().upload_items(to_upload, http_client, selector)))
|
|
326
|
-
return results
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
class FileMetaAdapter(
|
|
330
|
-
LinkingAdapter[
|
|
331
|
-
str,
|
|
332
|
-
FileMetadataWrite,
|
|
333
|
-
FileMetadata,
|
|
334
|
-
FileMetadataWriteList,
|
|
335
|
-
FileMetadataList,
|
|
336
|
-
]
|
|
337
|
-
):
|
|
338
|
-
"""Adapter for migrating file metadata to data model instances.
|
|
339
|
-
|
|
340
|
-
This is necessary to link asset-centric FileMetadata to their new CogniteFile instances using the
|
|
341
|
-
files/set-pending-instance-ids.
|
|
342
|
-
"""
|
|
343
|
-
|
|
344
|
-
PENDING_INSTANCE_ID_ENDPOINT: ClassVar[str] = "/files/set-pending-instance-ids"
|
|
345
|
-
|
|
346
|
-
def __init__(self, client: ToolkitClient, skip_linking: bool) -> None:
|
|
347
|
-
super().__init__(client, FileMetadataIO(client), skip_linking)
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
class TimeSeriesIOAdapter(
|
|
351
|
-
LinkingAdapter[
|
|
352
|
-
str,
|
|
353
|
-
TimeSeriesWrite,
|
|
354
|
-
TimeSeries,
|
|
355
|
-
TimeSeriesWriteList,
|
|
356
|
-
TimeSeriesList,
|
|
357
|
-
]
|
|
358
|
-
):
|
|
359
|
-
"""Adapter for migrating time series to data model instances.
|
|
360
|
-
|
|
361
|
-
This is necessary to link asset-centric TimeSeries to their new CogniteTimeSeries instances using the
|
|
362
|
-
timeseries/set-pending-instance-ids.
|
|
363
|
-
"""
|
|
364
|
-
|
|
365
|
-
PENDING_INSTANCE_ID_ENDPOINT: ClassVar[str] = "/timeseries/set-pending-instance-ids"
|
|
366
|
-
|
|
367
|
-
def __init__(self, client: ToolkitClient, skip_linking: bool) -> None:
|
|
368
|
-
super().__init__(client, TimeSeriesIO(client), skip_linking)
|
|
File without changes
|