edgedb-python
edgedb-python copied to clipboard
Support dataclasses for queries
Seeing as this client library does not yet support a query builder, I would love to be able to pass in dataclasses when I'm making queries with EdgeQL. It would be something like this:
@dataclass
class QueryStruct:
foo: str = "bar"
... # Ellipsis intended
Additionally, if possible, I'd like to see if we could get support for other dependencies such as attrs or pydantic. Especially with attrs, we could support converters and validators to help ensure with the query building process that data is properly being sent.
import edgedb
@attrs.define()
class QueryStruct:
foo: QueryStruct = attrs.field(converter=QueryStruct, validator=edgedb.validate_query_struct)
...