Now the Python SDK supporting the cursor parameter or not?
Regards,
Ayushi.
Best answer by roman.chesnokov
I see; then probably the best way is to use our REST API directly. You can find the docs here. As far as I know, there are no plans for implementing cursor usage by users via SDK.
Hi Shah, the Python SDK only supports the cursor parameter to list the transformation schedules, but there are different approaches that you can implement if you need pagination. For example, for datapoints you can use timestamps for pagination. You can also read some additional info about the performance of datapoints retrieval here.
Actually, I am trying to retrieve events but there is more than thousands of events and it’s taking more time to give response so i want to do pagination and looking for cursor value using python sdk. Could you please help me?
The first approach uses a cursor under the hood, it uses a generator and makes an API call for each chunk. Could you explain to me the requirements and why you need a cursor specifically?
the approach of using client.events(chunk_size=250) will not work in our case, because we want to use pagination in our backend to deliver data to our frontend, so we need to know what the nextCursor value is to be able to query for the next chunk if required.
Is there a way to get the cursor value using the SDK ?
If not is Cognite planning to upgrade the SDK to allow the user to work with the cursor value ?
Then next_chunck is a list of the next 250 events. And request to API happens when you call the next function. So it uses a cursor, but you don’t need to handle it by yourself. Do you think it will work for you?
Consider this scenario: Our UI requests using our backend to list the first 30 Events. Backend using Cognite Python SDK queries the first 30 events from Cognite and returns them to out UI. User wants to see the next page the UI requests the next page from the Backend, but since the backend is stateless will not know how to retrieve the next 30 events from CDF.
This is why we need to have the cursor so that when the UI requests the new page the cursor is there to identify the next page.
It is the same as what the Fusion UI does when listing events on the “Explore” page
I see; then probably the best way is to use our REST API directly. You can find the docs here. As far as I know, there are no plans for implementing cursor usage by users via SDK.