cognitedata / cognitedata/cognite-sdk-python

Entity matching retrieve endpoint does not return None

Open
#1,593 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
92
Forks
38
Avg merge
2d 9h
Merged PRs (30d)
42

Description

System information (please complete the following information):

  • OS: [14.1.2 (23B92)
  • Python Version: Python/3.10.5
  • SDK Version: Latest

Describe the bug
The client.entity_matching.retrieve endpoint raises an error if the model does not exist. It should return None.

To Reproduce
Runnable code reproducing the error.

from cognite.client import CogniteClient

client = CogniteClient()

client.entity_matching.retrieve(external_id = "1234")
#assuming that model with ex_id = "1234" does not exist.

Expected behavior
It should not raise an error, but return None.

https://github.com/cognitedata/cognite-sdk-python/blob/50e35acd91c35af8d33ef55ca2f44851f99ddf10/cognite/client/_api/entity_matching.py#L43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cognite/client/_api/entity_matching.py at the retrieve endpoint referenced by the issue, and reproduce the request with a nonexistent external_id such as "1234". Done means the endpoint returns None instead of raising an error for a missing model.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.