Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dataclasses for queries #358

Open
i0bs opened this issue Aug 7, 2022 · 0 comments
Open

Support dataclasses for queries #358

i0bs opened this issue Aug 7, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@i0bs
Copy link

i0bs commented Aug 7, 2022

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)
    ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants