Skip to content

creating a query using DSL #315

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

Closed
mselgamal opened this issue Mar 30, 2022 · 4 comments
Closed

creating a query using DSL #315

mselgamal opened this issue Mar 30, 2022 · 4 comments
Labels
type: documentation An issue or pull request for improving or updating the documentation type: question or discussion Issue discussing or asking a question about gql

Comments

@mselgamal
Copy link

Hi,

i have the following query

"query {
alertSearch(in: {cql_query: "do this then that}) {
status
reason
}
}"

i'm trying to use DSL to construct the query, is there an example for how to include Input types ? "in" is an input type in the schema

any help is appreciated, thanks

@leszekhanusz
Copy link
Collaborator

You just have to call the field with your arguments. See the documentation
gql will serialize into the the query even complex arguments in lists and/or dicts.

Here is a more complex example in test_dsl.py. It uses variables but should also work providing the values directly instead of using variables.

@leszekhanusz leszekhanusz added the type: question or discussion Issue discussing or asking a question about gql label Mar 31, 2022
@leszekhanusz
Copy link
Collaborator

I just noticed that your argument is "in" which is a reserved keyword in python, so it is a bit more complicated to add it.
See Issue #308

We should probably add a note about that in the documentation.

@leszekhanusz leszekhanusz added the type: documentation An issue or pull request for improving or updating the documentation label Mar 31, 2022
@mselgamal
Copy link
Author

awesome, fixed. thanks alot.

@leszekhanusz
Copy link
Collaborator

A little note was now added in the documentation in #317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating the documentation type: question or discussion Issue discussing or asking a question about gql
Projects
None yet
Development

No branches or pull requests

2 participants