cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass page_token while calling API to get query history in SQL warehouse

ayush25091995
New Contributor III

Hi,

I am getting each queryid getting duplicated in next page when calling API query history for SQL warehouse in next page, how ever page token is different for different pages.

how should we pass Page token ?since in databricks doc, it is mentioned we should pass it as encoding but i am not getting how we can pass in payload?

Ex:- we have 64 rows in total and if we are passing max_Result as 10, then it is creating 7 pages but all 7 pages has same data i.e duplicates for 10 rows in each 7 pages.

Thanks,

Ayush

2 REPLIES 2

ayush25091995
New Contributor III

any help on this plz?

Hi @ayush25091995, To pass the page_token while calling the API to get query history in the SQL warehouse, you’ll need to encode the token before using it in the URL. Specifically, characters like ‘+’ should be replaced by %2B. This ensures that the token is correctly interpreted by the API.

Here’s how you can handle the page_token:

  1. Retrieve the page_token from the previous page’s response.
  2. Encode the token using URL encoding rules (e.g., replace ‘+’ with %2B).
  3. Include the encoded page_token in the URL for the next page request.

By following these steps, you should be able to paginate through the query history results without encountering duplicate data. If you have any further questions or need additional assistance, feel free to ask! 😊

For more details, you can refer to the Databricks REST API reference.1

 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group