-
Notifications
You must be signed in to change notification settings - Fork 1
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
Sol1james patch 1 #1
base: master
Are you sure you want to change the base?
Conversation
Updating doco to reflect the need to encapsulate the result set in a list
Hey, thanks for the PR! I'm not sure we'd want to make this the canonical example for I'm not saying we shouldn't mention it, like I pointed out in the issue, it's been brought up more than once since the change. I just don't know about it being the example. If that makes any sense. |
I'll write a more nuanced description then. If someone does use the all() method, what do they then need to do to start iterating over the collection from the beginning again? Do they need to re-instantiate the API object with pynetbox.api()? It would also be helpful to get some clarification about the mechanics of all this. The all() method takes a parameter 'limit' - I assume that when you call all() it will fetch this number of records and presumably cache them? And not do any more requests to the server across the network until the cache is empty? And if you convert it to a list it will fetch the entirety of the result set which will be stored in the list? It seems like the main question the user is faced with is whether they want to reduce network usage. If they do they use all(). If they want the data stored locally they use list(all()) |
Thanks, I appreciate the effort to clarify. To start over from the beginning you'd call
Close, but no caching. Limit is, in effect, passed on to the NetBox paginator. So each time we need to make a call for the next page it contains the same number of items specified by limit. For example, If you're iterating over the RecordSet and passed a limit of 50, when you reach the 50th item we'll make a call for the next 50 items and so on until you're done traversing the results.
Yes
More-or-less, though I'd always encourage using |
Updating doco to reflect the need to encapsulate the result set in a list when calling the all() method of an endpoint.
I'm not sure if it needs more explanation than this so I'm erring on the side of brevity.
See disscussion in netbox-community#450