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: 

Is it possible to migrate SQL Objects from one workspace to another?

valjas
New Contributor III

We have SQL Queries and dashboards in workspace dev_01. New workspace dev_02 is created and unity catalog is enabled.

I was able to migrate jobs, clusters, DLTs, SQL warehouses, users using APIs. But, while migrating queries using APIs, I can't get them to the same user folder as in dev_01. I am facing error saying 'no parent folder'. When I ignore this parameter, the queries are being created in my workspace folder instead of workspace of actual creator of that query. Is there a way to get queries into dev_02 and into same user folders as in dev_01?

The same question for SQL dashboards also. Is it possible to migrate them to dev_02 seemlessly?

1 REPLY 1

jcoggs
New Contributor II

I'm doing something similar, but I haven't run into this parent directory issue. [Actually to be clear I ran into an issue around missing user directories, but I believe that was different than what you describe]. Before migrating the queries, I'm recreating the workspace directories from the original workspace within the new workspace (really I'm going from one tenant to another, but I believe our experiences are still the same). I then create a map between ids of corresponding directories and use this map to create queries in the correct corresponding directory.  For the workspace directories I'm using these two endpoints:

  1. https://docs.databricks.com/api/workspace/workspace/list
  2. https://docs.databricks.com/api/workspace/workspace/mkdirs

You mentioned you are using APIs to move the queries, but just to be clear, I'm using these endpoints:

  1. https://docs.databricks.com/api/workspace/queries/list
  2. https://docs.databricks.com/api/workspace/queries/create

Are you doing something similar? 

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