From 36f60a7d8c36dc64c533ab9c4e539c4cbfee2d35 Mon Sep 17 00:00:00 2001 From: anders-albert Date: Thu, 31 Jul 2025 17:10:19 +0200 Subject: [PATCH] fix: raise if parent ID is set --- .../_cdf_tk/loaders/_resource_loaders/location_loaders.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/location_loaders.py b/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/location_loaders.py index a8efb2ae6e..d675e5e569 100644 --- a/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/location_loaders.py +++ b/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/location_loaders.py @@ -16,7 +16,7 @@ LocationFilterWriteList, ) from cognite_toolkit._cdf_tk.constants import BUILD_FOLDER_ENCODING -from cognite_toolkit._cdf_tk.exceptions import ResourceRetrievalError, ToolkitCycleError +from cognite_toolkit._cdf_tk.exceptions import ResourceRetrievalError, ToolkitCycleError, ToolkitNotSupported from cognite_toolkit._cdf_tk.loaders._base_loaders import ResourceLoader from cognite_toolkit._cdf_tk.resource_classes import LocationYAML from cognite_toolkit._cdf_tk.utils import in_dict, quote_int_value_by_key_in_yaml, safe_read @@ -103,6 +103,9 @@ def safe_read(self, filepath: Path | str) -> str: return quote_int_value_by_key_in_yaml(safe_read(filepath, encoding=BUILD_FOLDER_ENCODING), key="version") def load_resource(self, resource: dict[str, Any], is_dry_run: bool = False) -> LocationFilterWrite: + if "parentId" in resource: + raise ToolkitNotSupported("The property 'parentId' is not supported. Use 'parentExternalId' instead.") + if parent_external_id := resource.pop("parentExternalId", None): # This is a workaround: when the parentExternalId cannot be resolved because the parent # hasn't been created yet, we save it so that we can try again "later"