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

qb: Array producing functions don't work?

Open msullivan opened this issue 3 months ago • 0 comments

        q = default.GameSession.select(
            "*",
            players=True,
        ).filter(
            lambda g: std.array_agg(g.players.id)
            == std.array_agg(green.users.id)
        )

fails at runtime with

  File "/home/sully/src/e/edgedb-python/gel/_internal/_qb/_generics.py", line 300, in wrapper
    return attrval(*args, __operand__=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qbmodel/_abstract/_methods.py", line 140, in filter
    add_filter(cls, *exprs, __operand__=__operand__, **properties),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qbmodel/_abstract/_expressions.py", line 269, in add_filter
    all_exprs = [_qb.edgeql_qb_expr(expr, var=prefix) for expr in exprs]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qb/_protocols.py", line 145, in edgeql_qb_expr
    x = x(var)
        ^^^^^^
  File "/home/sully/src/e/edgedb-python/tests/test_qb.py", line 371, in <lambda>
    lambda g: std.array_agg(g.players.id)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qb/_generics.py", line 213, in <lambda>
    lambda self, other, op=op: self.__infix_op__(op, other),
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qb/_generics.py", line 333, in __infix_op__
    type_class = this_operand.__gel_type_class__
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Array[models.orm.__shapes__.std.uuid]' has no attribute '__gel_type_class__'

And it fails to typecheck because __eq__ is not overloaded on Array in a way visible to the typechecker. (And the way not visible seems broken?)

msullivan avatar Sep 03 '25 01:09 msullivan