cognite-toolkit 0.7.62__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.
@@ -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.62
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.62
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.62"
7
+ version = "0.7.63"
8
8
 
9
9
 
10
10
  [plugins]
@@ -1 +1 @@
1
- __version__ = "0.7.62"
1
+ __version__ = "0.7.63"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.7.62
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>
@@ -225,7 +225,7 @@ cognite_toolkit/_cdf_tk/commands/_import_cmd.py,sha256=_qUF8xdJFoXDbtDYGCVC6kz9k
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
227
  cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py,sha256=-LTIQUalqlRZxK0rfKWqljHLVh8VIH7yq_P-timfQDw,18318
228
- cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=Gp3CKruTxeSDS3HiWiLsQ4mN2SZ4BQB5xQ50o68GTs8,9616
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=jJYHZX7YNodw2J3zPCKpUt7zOcRq4Z9DDWSUFu2mpMc,667
436
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=a2RU5KGKbZS_SSvkInZtkbswTrWMQkqSr42Wlhx4Di0,2430
437
- cognite_toolkit/_resources/cdf.toml,sha256=r-m4fwgvn8-Q6ZHEEr7NWW9HOhavJZUCNxlS7_HcTjA,475
438
- cognite_toolkit/_version.py,sha256=-lU0l5-pIa7inPRB-7jzbkH90Ef12r9upMApt29G7Nk,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.62.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
442
- cognite_toolkit-0.7.62.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
443
- cognite_toolkit-0.7.62.dist-info/METADATA,sha256=WAFBnCs67Rq4CJev_KTtMluhrABDvTE_5yrnOVbuJKg,5026
444
- cognite_toolkit-0.7.62.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,,