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

prohibit specifying computeds that type doesn't have declared

Open 1st1 opened this issue 6 months ago • 3 comments

MyType.select(computed=...) should be prohibited at the type level if MyType doesn't have computed. We won't be able to unpack fields we don't have definitions for, so we have to simply reject this at the typing level.

1st1 avatar Jun 29 '25 02:06 1st1

@1st1, I'm not sure there is a way to achieve this at the typing level currently. We generate the signature for select in generated models, there is no general way of "transplanting" class annotations onto an arbitrary method signature (@dataclass_transform is special and hardcoded to __init__). Something to address in a typing PEP.

elprans avatar Jul 02 '25 19:07 elprans

We can't do this with the current typing

1st1 avatar Jul 07 '25 19:07 1st1

Do this at runtime

1st1 avatar Jul 07 '25 19:07 1st1