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?