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.
[Bug] Label name and external_id fields are swithced
Hi
I will create a Support ticket, so our team can follow up and help you.
Best regards,
Dilini
This issue might be related to
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.