Skip to main content

Hello, 

 

We have trouble deploying new container via cdc-toolkit after changing an attribute property. We have the following error: 
 

cognite.client.exceptions.CogniteAPIError: Cannot change type for property │

│ 'PullDate' in container 'space:container'. | code: 400

 

Notes;

  • This container contains data before this change
  • We incremented the model version to a new major one
  • We have consumers consuming the current version

What is the best practice for handling this kind of changes with the least effect on our current consumers ? 

 

Thanks,

@Marwen TALEB 

You my getting this erro message because of Immutable Schema Principle that is a best practice for some cases. Instead of changing the type of an existing one. For example, you could add a new attribute like PullDate_v2 with the updated type and maintain the old PullDate for backward compatibility.

Use a batch job to update old records with the new PullDate_v2 while keeping the original PullDate intact for backward compatibility during the transition than keep the original PullDate in place for a grace period. Mark it as deprecated in the documentation, allowing current consumers to switch to the new property without breaking the system immediately.

Let's explore alternative approaches from the Cognite team before making a final decision. There might be more efficient or less disruptive solutions that they can propose.

Cheers,
André


Andre is on point here. We currently do not support deletion of container properties for precisely this reason. To ensure a smooth transition for apps using a given version of a data model you can define new versions mapping in the new version of a container property in place of an old one, and transition apps to the new version of your data model at your leisure.

Thanks,

-AndersM


Reply