-
Notifications
You must be signed in to change notification settings - Fork 818
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
Dealing with cursors in ConnectionField resolve functions #62
Comments
Hi @bigblind, In the example of Starwars relay the So, for example, when you are using django querysets, the list is only "resolved" (aka queried in the DB) when we iter though it (when we return the resolved result), and after the list is sliced. So it will already do in the most optimal way :) |
Can I just create my own field with a type of `r.db("my_db").table("users").between(cursor, r.maxval).limit(first+1).run(connection)`` If you're not interested in rethinkdb, I don't expect you to look up how this code works, but I wanted to give a use case for actually doing this. The reason I'm fetching |
Good catch. I will rethink better how we can handle this. |
Similar case here working with AppEngine's NDB (would be the same for HBase or most other nosqls I guess). Example fetching a page:
Is there a way to implement this logic of iterating a big list with no len() ? |
Hi @bigblind . We're currently going through old issues that appear to have gone stale (ie. not updated in about the last 6 months) to try and clean up the issue tracker. If this is still important to you please comment and we'll re-open this. Thanks! |
In the Star Wars relay example, it looks like you expect the
resolve_ships
method of theFaction
class to return every ship. While this is feasible with a small dataset like that, it's not an assumption you can make. Does the resolve function get access to thefirst
andafter
argument? Also, how do we supply pagination info?Looking at the code, it looks like
connection_from_list
deals with the resolved data as a complete list. Is there a way to get around this? If the resolve function only gets the arguments, but no way to supply pagination info, should we just return 1 more object than was requested, so thatconnection_from_list
knows there's more and can correctly create the pagination info?The text was updated successfully, but these errors were encountered: