edgedb-python icon indicating copy to clipboard operation
edgedb-python copied to clipboard

Unexpected interface error for query_single[_json]

Open spacemanspiff2007 opened this issue 1 year ago • 0 comments
trafficstars

Describe the bug

Query single methods raise unexpected error without executing the query

Reproduction Use _example project

    await db.query_single_json(
        'select Movie {**} filter .release_year = <int32>$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

spacemanspiff2007 avatar Nov 18 '24 12:11 spacemanspiff2007