-
Notifications
You must be signed in to change notification settings - Fork 229
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
How to query by argument? #16
Comments
This worked for me following the Graphene docs. I think the Django Graphene project has some automatic filter support but I couldn't find the parallel implemented for this. You explicity define the arguments, in my case "pk". They then appear in your args in your resolve func where you can manually filter.
|
Mmh, ok, I assumed that this kind of automatic filtering is part of the SQL Alchemy / Graphene extension. I really would like to see that implemented, but I doubt I could figure out how to extend the library to do so :-( |
This seems rather limiting if this isn't supported |
@steinsag You will need to update your Query in schema.py to: class Query(graphene.ObjectType):
node = relay.Node.Field()
all_employees = SQLAlchemyConnectionField(Employee)
all_roles = SQLAlchemyConnectionField(Role)
role = relay.Node.Field(Role) This will allow you to select roles by id with: query Role($id: ID!){
role(id: $id) {
id
name
}
} |
Will work without additionally adding |
+1 It would be great to have this. |
So I get that you can query with the relay ID. But I want to query by something else. Like name. How do i do that? |
I figured out how to do filtering for any field. I posted a possible solution here: #27 |
I am closing all old issues&PRs related to filtering. The discussion will continue in #347 (WIP). A proposal for the implementation of filters is currently being worked on and will be posted there once it is ready. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue. |
I was wondering if querying a schema via specific arguments is supposed to work out of the box or if anything special must be done to make it work?
In case of the flask example, I was expecting the following to be a valid query:
But I only get
So how would I need to extend the example so that I could search employees by their name or retrieve a role via the ID? Or is my query just wrong?
The text was updated successfully, but these errors were encountered: