cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Deploying existing queries and alerts to other workspaces

erigaud
Honored Contributor

I have several queries and associated alerts in a workspace, and I would like to be able to deploy them to an other workspace, for example an higher environment. 

Since both queries and objects are not supported in repos, what is the way to go to easily recreate queries/alerts somewhere else ?

I saw a very similar post on the community that recommended using the API, so my question is : is there a way to export an existing query/alert to json to easily recreate it through the API (in a similar fashion as to a job) ? 

Also, could Unity Catalog be of any help for this task ?

Thank you !

4 REPLIES 4

btafur
Contributor III
Contributor III

It is possible to do this via API. With the API you can:

With alerts you can do something similar: 

 

erigaud
Honored Contributor

The API allows me to create queries, but apparently not to recreate existing queries it seems ? For example the API does not allow me to recreate the schedule of a query right ?

btafur
Contributor III
Contributor III

It is not explicitly stated in the Docs but there is a "schedule" option in the payload for a query definition with the following structure:

 

schedule {
cron : 2 55 9 ? * 2
time : null
until : null
version : 2
interval : null
day_of_week : null
}
 
The best way of knowing the full structure of the query definition is to use the API to GET the query definition of an existing query that has the "schedule" enabled. https://docs.databricks.com/api/azure/workspace/queries/get 
 
You should be able to recreate all the options via the API.

Anonymous
Not applicable

Hi @erigaud 

We haven't heard from you since the last response from @btafur , and I was checking back to see if her suggestions helped you.

Or else, If you have any solution, please share it with the community, as it can be helpful to others. 

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.