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:ย 

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

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

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.

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