-
Notifications
You must be signed in to change notification settings - Fork 184
How to reuse connection when using DSL? #138
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
Comments
It is not possible to reuse the connection with the current DSL code. |
That makes sense. For now, I'm doing this
If I understood you properly, in the future, it might be possible to do this
and avoid the trip back to text and parsing? |
Yes, exactly, something like this. |
I refactored the DSL code and the proposed way is a little bit different. query = dsl_gql(DSLQuery(ds.Query.hero.select(ds.Character.name)))
result = session.execute(query) |
Refactoring of the DSL code. The DSLSchema only needs a schema, a Client is no more needed. New dsl_gql function to convert the DSL operations into a Document This allows DSL queries to be executed in a session instead of a client (Solves #138) Added typing annotations Added code documentation and sphinx docs (Solves #82) Supports Subscriptions Fix nested input arguments Allow to set the alias directly in the select method Allow multiple operations in a document Allow to set the operation name
Fixed in v3.0.0a5 |
Each DSL operation calls
self.client.execute
which apparently creates a new connection each time. Passing asession
toDSLSchema
doesn't work and causes an infinite recursion.Is there some known good way to reuse the connection when using DSL? Is the
session
meant to work, and this is simply a bug?The text was updated successfully, but these errors were encountered: