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: 

get saved query by name using rest API or databricks SDK

mahfooziiitian
New Contributor II

Hi All,

I want to get the saved query by name using rest API or databricks SDK. So It do not find any direct end point or method which can give us the saved query by name.

I have one solution as given below:

  1. get the list all queries
  2. filter the my queries from list of queries

But databricks is saying that if you are calling list all queries end point (List queries ) multiple then it might ban temporarily.

Can you suggest us how can I get the query without using list all queries end point?

mahfooz.iiitian
3 REPLIES 3

szymon_dybczak
Contributor III

Hi @mahfooziiitian ,

  1. The answer is no, currently you can get saved query only by id. If your are afraid of exceeding concurrent calls, then design a process that as a first step will use list queries endpoint to extract endpoint IDs and names and save that information to a Delta Table. Then you can lookup endpoint names, IDs in that table and use it to download specific query in later steps of the process. That's how you can avoid exceeding API limits

I have tried this solution but problem with this solution is that new query details will not be available until we are preloading the data again. I am thinking of using pagination by using attributes page_token,next_page_token,page_size and loop through it until we find the query. This might not exceed concurrent API Limit. I need to just verify it with databricks team.

mahfooz.iiitian

Cool that you found workaround that works for you.

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