geldata / geldata/gel-python

Unexpected interface error for query_single[_json]

Open
#543 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
415
Forks
50
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Query single methods raise unexpected error without executing the query

**Reproduction**
Use `_example` project

```python
await db.query_single_json(
'select Movie {**} filter .release_year = $release_year',
release_year=32
)
```
raises
````
InterfaceError('query cannot be executed with query_single_json() as it may return more than one element')
````

**Expected behavior**
I would expect the behavior that is described in the docs:
The query must return no more than one element. If the query returns more than one element, an `edgedb.ResultCardinalityMismatchError` is raised, if it returns an empty set, "null" is returned

So the expected behavior is no exception except when multiples entries are returned

- OS:
- EdgeDB version: 5.6+b7b0563
- EdgeDB CLI version: EdgeDB CLI 5.5.2+1743aac
- `edgedb-python` version: 2.2.0
- Python version: 3.12

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.