https://linen.dev logo
#singer-tap-development
Title
# singer-tap-development
a

alex_dimov

11/28/2022, 12:37 PM
Hello. Please help me figure out JSONPathPaginator. The fact is that I started using it, and for some reason it returns me the id not of the last entry from the list, but of the first one. It's happening here
Copy code
def get_next(self, response: Response) -> str | None:
        """Get the next page token.

        Args:
            response: API response object.

        returns:
            The next page token.
        """
        all_matches = extract_jsonpath(self._jsonpath, response.json())
        return next(all_matches, None)
Here is my example
Copy code
[
   {
      id: 1
      dateTime: "11-10-2022T12:03:00"
   },
   {
      id: 2
      dateTime: "11-10-2022T12:04:00"
   },
   {
      id: 3
      dateTime: "11-10-2022T12:06:00"
   },
]
This function returns 1. But it would be logical for me if it returned 3 (so that in the next query I could put where id > 3 Please help me understand this moment. I understand that I can redefine this function and make it return the last element instead of the first one, but I want to understand why this function was originally described so that it returns the first element? (Perhaps it is described for the case of sorting in descending order?)