Closed emboehm closed 1 year ago
Hi @emboehm, thanks for reporting this to us!
May I ask why you need use marker
paging instead of limit-offset
?
As you can see, limit-offset
paging is fully supported and you can read about it here .
When it comes to add support to user-marker
paging, I've already created a ticket SDK-2810 for this.
We will discuss the plan and timeline for this feature with the SDK team.
Regards, Artur
Hi Artur,
I didn't see your ticket SDK-2810. I tried a search for the issue with author:arjankowski type:ticket
. Could you provide a pointer to the ticket. I have a question that might be answered in the ticket.
I am using marker
paging instead of limit-offset
because limit-offset
wasn't working. It would just hang.
We have an enterprise account with hundreds of thousands of items in the trash. We have opened several tickets with Box on the problems we are having because of this, without a resolution.
100K+ items makes it impractical to clean up the trash -- permanently delete items -- through the GUI. That is why I am resorting to using the sdk
to permanently delete items.
I cannot get a listing of the trash in a browser without using /trash?usemarker=true
.
I tried to get_items
with the sdk
but that would hang for several minutes before I killed it. That is when I went looking for the option to use use_marker=True
, based on my experience with the browser.
The marker
pagination also seems to be significantly faster than limit-offset
.
This is marker
pagination:
Loop iterations: 1000, Elapsed time: 0:00:08
Total iterations: 1000, Total time: 0:00:08
Current time: 2022-12-08T05:12:35
This is limit-offset
pagination:
Loop iterations: 1000, Elapsed time: 0:01:26
Total iterations: 1000, Total time: 0:01:26
Current time: 2022-12-08T04:58:57
marker
pagination is about 10x faster (8 seconds vs 86 seconds)
-- Eric
Hi @emboehm, I created this ticket internally on our Jira, that's why you don't see it. But when it comes to adding a 'marker', we planned the works for the beginning of January.
Regards, Artur
Artur,
My question then is this: why are there two separate implementations for get_item/get_items
depending on whether it is a folder or Trash?
It seems to me like the code is duplicated, creating a bit of a maintenance headache. Updates/fixes to folder.get_item(s)
don't necessarily make it to trash.get_item(s)
.
Hi @emboehm,
Thank you for your feedback, we will certainly take it into account when implementing this change.
Folders and Trash APIs are separate services, operating on a different domain, which have separate implementations in the backend and a different direction of development. The fact that at the moment they have the same API may change.
Therefore, in our python implementation, they do not have a common implementation, but instead use common generic components such as MarkerBasedObjectCollection
or LimitOffsetBasedObjectCollection
.
Regards, Artur
Hi Artur,
I appreciate the explanation. Trash looked like just another instance of folder at first glance. It makes sense that the implementations are separate, given that they are separate services.
-- Eric
Good morning @emboehm,
As this issue already fixed in the PR #781, and it will be ready in new the Box SDK version which will release in upcoming weeks. We're closing this issue for now, if you have any other problem, feel free to open it again.
Regards, Minh
Hi @emboehm, the feature is now ready to use in new Python boxsdk 3.6.0 release. Best, @lukaszsocha2
Hi @lukaszsocha2
I pulled the latest release and it is working fine for me.
Thanks, @emboehm
I noticed that when I tried to use
I would get the following error
I verified that the API supports use_marker=True for trash https://developer.box.com/reference/get-folders-trash-items/
Steps to Reproduce
Expected Behavior
I expected to receive a list of items from the trash.
Error Message, Including Stack Trace
Possible fix
I looked at the code in https://box-python-sdk.readthedocs.io/en/latest/_modules/boxsdk/object/trash.html#Trash.get_items and compared it with the code for folders, that correctly implements use_marker=True https://box-python-sdk.readthedocs.io/en/latest/_modules/boxsdk/object/folder.html#Folder.get_items
I identified the missing code and added the changes to boxsdk/object/trash.py.
I was able to list items from the trash using marker based pagination after making these changes.
Versions Used
Python SDK: 3.5.0 Python: 3.7.1