[Bug] Label name and external_id fields are swithced
When creating Labels, the “external_id” and “name” fields are switched. I’ve previously reported this for C#. It turns out the error is also found in the Python SDK:
Repro steps
Replicating the bug is trivial. Consider the following code in Python:
label = LabelDefinition(external_id=”label_x”, name=”x”, data_set_id=DATASET_ID)
client.labels.create(label)
Use the label on an asset, and CDF will display “label_x” as the label name. The two fields are somehow swithced.
Persistance or display issue?
Ok, so is CDF just displaying the wrong field? It’s hard to tell due to other issues around labels, but consider this: As a fix, I chose to align the “external_id” and “name“ fields, landing on the something like this.:
label = LabelDefinition(external_id=”x”, name=”x”, data_set_id=DATASET_ID)
client.labels.create(label)
Resulting in an error
CogniteDuplicatedError: Duplicated: [{'externalId': 'x'}]
The API Failed to process some items.
Check the
documentation
Ask the
Community
Take a look
at
Academy
Cognite
Status
Page
Contact
Cognite Support
