cognite-toolkit 0.7.61__py3-none-any.whl → 0.7.63__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.
@@ -745,7 +745,7 @@ class MigrateApp(typer.Typer):
745
745
  )
746
746
  cmd = MigrationCommand(client=client)
747
747
 
748
- if data_set_id is None:
748
+ if data_set_id is None and mapping_file is None:
749
749
  skip_linking = not questionary.confirm(
750
750
  "Do you want to link old and new Files?", default=not skip_linking
751
751
  ).unsafe_ask()
@@ -137,11 +137,19 @@ class DirectRelationCache:
137
137
  if source_ids:
138
138
  # SourceSystems are not cached in the client, so we have to handle the caching ourselves.
139
139
  cache = cast(dict[str, DirectRelationReference], self._cache_map[self.TableName.SOURCE_NAME])
140
- missing = set(source_ids) - set(cache.keys())
140
+ missing: dict[str, str] = {}
141
+ for source_id in source_ids:
142
+ if source_id.casefold() not in cache:
143
+ missing[source_id.casefold()] = source_id
144
+ elif source_id not in cache:
145
+ missing[source_id] = source_id
141
146
  if missing:
142
147
  source_systems = self._client.migration.created_source_system.retrieve(list(missing))
143
148
  for source_system in source_systems:
144
- cache[source_system.source] = source_system.as_direct_relation_reference()
149
+ source_reference = source_system.as_direct_relation_reference()
150
+ cache[source_system.source] = source_reference
151
+ if original_str := missing.get(source_system.source):
152
+ cache[original_str] = source_reference
145
153
  if file_ids:
146
154
  self._update_cache(self._client.migration.lookup.files(id=list(file_ids)), self.TableName.FILE_ID)
147
155
  if asset_external_ids:
@@ -20,6 +20,7 @@ from cognite.client.data_classes.documents import SourceFileProperty
20
20
  from cognite.client.data_classes.events import EventProperty
21
21
 
22
22
  from cognite_toolkit._cdf_tk.client import ToolkitClient
23
+ from cognite_toolkit._cdf_tk.client.resource_classes.data_modeling import NodeReference
23
24
  from cognite_toolkit._cdf_tk.client.resource_classes.legacy.apm_config_v1 import APMConfig, APMConfigList
24
25
  from cognite_toolkit._cdf_tk.cruds import NodeCRUD, ResourceCRUD, SpaceCRUD
25
26
  from cognite_toolkit._cdf_tk.exceptions import ToolkitMissingResourceError, ToolkitRequiredValueError
@@ -146,6 +147,7 @@ class SourceSystemCreator(MigrationCreator[NodeApplyList]):
146
147
  self.hierarchy = hierarchy
147
148
 
148
149
  def create_resources(self) -> NodeApplyList:
150
+ existing_resources = self._get_existing_source_systems()
149
151
  seen: set[str] = set()
150
152
  nodes = NodeApplyList([])
151
153
  for source in self._lookup_sources():
@@ -153,6 +155,9 @@ class SourceSystemCreator(MigrationCreator[NodeApplyList]):
153
155
  if not isinstance(source_str, str) or source_str in seen:
154
156
  continue
155
157
  seen.add(source_str)
158
+ if existing_id := existing_resources.get(source_str):
159
+ self.client.console.print(f"Skipping {source_str} as it already exists in {existing_id!r}.")
160
+ continue
156
161
  nodes.append(
157
162
  NodeApply(
158
163
  space=self._instance_space,
@@ -165,6 +170,10 @@ class SourceSystemCreator(MigrationCreator[NodeApplyList]):
165
170
  )
166
171
  return nodes
167
172
 
173
+ def _get_existing_source_systems(self) -> dict[str, NodeReference]:
174
+ all_existing = self.client.migration.created_source_system.list(limit=-1)
175
+ return {node.source: NodeReference(space=node.space, external_id=node.external_id) for node in all_existing}
176
+
168
177
  def resource_configs(self, resources: NodeApplyList) -> list[ResourceConfig]:
169
178
  output: list[ResourceConfig] = []
170
179
  for node in resources:
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.7.61
15
+ image: cognite/toolkit:0.7.63
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.61
13
+ image: cognite/toolkit:0.7.63
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.61"
7
+ version = "0.7.63"
8
8
 
9
9
 
10
10
  [plugins]
@@ -1 +1 @@
1
- __version__ = "0.7.61"
1
+ __version__ = "0.7.63"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.7.61
3
+ Version: 0.7.63
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>
@@ -10,7 +10,7 @@ cognite_toolkit/_cdf_tk/apps/_download_app.py,sha256=Iw-q4lIMagFQ7b8RVRubUQNAPbq
10
10
  cognite_toolkit/_cdf_tk/apps/_dump_app.py,sha256=8Z0D2snV48FC5eMBYJQ9fDnaNQCII3yrgrGolRtSOSc,39325
11
11
  cognite_toolkit/_cdf_tk/apps/_import_app.py,sha256=5n5AF40HJ0Q_3LENCknG0MxH4pMUS8OwsqvtCYj_t7w,2086
12
12
  cognite_toolkit/_cdf_tk/apps/_landing_app.py,sha256=qZqO0qN33-6TTF9O4fYuNF6zhJH-QyUWsuElWr8sH6w,1365
13
- cognite_toolkit/_cdf_tk/apps/_migrate_app.py,sha256=XmSX8rYO65sfdYe5e8yjAofbhsfXa2kBFzGm3Kq4up8,49142
13
+ cognite_toolkit/_cdf_tk/apps/_migrate_app.py,sha256=RKCZwlOuHiQ8YSDYM5W2XQ6asitsdte-KuVHEG_JJUk,49167
14
14
  cognite_toolkit/_cdf_tk/apps/_modules_app.py,sha256=sbgTYVKSb-HdaSJrccZGLRj28ifCIjbxQC6eADy16vk,8958
15
15
  cognite_toolkit/_cdf_tk/apps/_profile_app.py,sha256=ilJ8GuFkzexEAqZDuEqp7P-H_RxSFH2oO1t_bcDhJIQ,7067
16
16
  cognite_toolkit/_cdf_tk/apps/_purge.py,sha256=P7WoQURdrUGDOvBQMZ695Xqj_j8Mfln6eIovGQdOqUE,14172
@@ -224,8 +224,8 @@ cognite_toolkit/_cdf_tk/commands/_download.py,sha256=dVddH9t7oGx1kdQ3CCYYQb96Uxx
224
224
  cognite_toolkit/_cdf_tk/commands/_import_cmd.py,sha256=_qUF8xdJFoXDbtDYGCVC6kz9kyrcN_abXV9nFicThvw,11276
225
225
  cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py,sha256=8ki04tJGH1dHdF2NtVF4HyhaC0XDDS7onrH_nvd9KtE,153
226
226
  cognite_toolkit/_cdf_tk/commands/_migrate/command.py,sha256=meyp2cFcq5Wtq4FvELSqdwHRA45o9FMWFL_5AnXALvc,13587
227
- cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py,sha256=-sZktmsDIqkhNg-kg95Ty6eTm7FiyFRi1ZQLOkZ5x2w,17889
228
- cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=Gp3CKruTxeSDS3HiWiLsQ4mN2SZ4BQB5xQ50o68GTs8,9616
227
+ cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py,sha256=-LTIQUalqlRZxK0rfKWqljHLVh8VIH7yq_P-timfQDw,18318
228
+ cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=-1dIhKKSbyfH9Wcc1BVP_WTOMhW4CvRFQ5gBBGquXIE,10241
229
229
  cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py,sha256=_b2hXpTUI2_t-WKHzYXw1iSGb3w4pcIb53CTi9rbJ7k,13667
230
230
  cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=qHYeFCBBGPejbgC_g_uHNM8fJLBkxWBBNKLFILkPaTI,28097
231
231
  cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py,sha256=0lRyDRJ8zo00OngwWagQgHQIaemK4eufW9kbWwZ9Yo0,7901
@@ -432,13 +432,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
432
432
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
433
433
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
434
434
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
435
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=zJSH3g3zv_WpISBObwAezRGoRTbW9u1Z0oet9teVHh0,667
436
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=IU0cSDAzXnlCj1Q_w1PPI5WRVPMk1XkTHVEMJ2fKilI,2430
437
- cognite_toolkit/_resources/cdf.toml,sha256=FmX_hAxEVzghXUlYYZtmUC2qrdhkv7fDpmDgzgFCa90,475
438
- cognite_toolkit/_version.py,sha256=nnN1KGFIyav_JeSFcpJNcA3TybG4__uPpHfhpv8AtFc,23
435
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=SirbUy0Kcvvbva0BeT1O4fZ4QWa6Chk8eR_GkoAtgwg,667
436
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=JQekh5r35a9AgCpXYwzT1QwzyqRHsTVR7pcxTOe2zOQ,2430
437
+ cognite_toolkit/_resources/cdf.toml,sha256=SOsS5JgHNeMYgeV_UWRXczssd6x0jutfuJCQjxJ8sAw,475
438
+ cognite_toolkit/_version.py,sha256=oQs5nDLBiJV3A-cTJuhMbabRY2LIGf9C4v6xF17N4gs,23
439
439
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
440
440
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
441
- cognite_toolkit-0.7.61.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
442
- cognite_toolkit-0.7.61.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
443
- cognite_toolkit-0.7.61.dist-info/METADATA,sha256=UrmXRAFcA-IvLVxM7J3ZkSQ-vLv6__j1dO9bBZWBBVk,5026
444
- cognite_toolkit-0.7.61.dist-info/RECORD,,
441
+ cognite_toolkit-0.7.63.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
442
+ cognite_toolkit-0.7.63.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
443
+ cognite_toolkit-0.7.63.dist-info/METADATA,sha256=DKhf2nuKq7ucWOMAqd3VPWoSqw3Dr2xdqPK2Y_uqpNM,5026
444
+ cognite_toolkit-0.7.63.dist-info/RECORD,,