Skip to content

Use X-Databricks-Workspace-Id for workspace routing#805

Open
Divyansh-db wants to merge 2 commits into
mainfrom
divyansh-vijayvergia_data/new-workspace-parameter
Open

Use X-Databricks-Workspace-Id for workspace routing#805
Divyansh-db wants to merge 2 commits into
mainfrom
divyansh-vijayvergia_data/new-workspace-parameter

Conversation

@Divyansh-db
Copy link
Copy Markdown
Contributor

Summary

Workspace-scoped API calls now identify the target workspace via the X-Databricks-Workspace-Id header instead of X-Databricks-Org-Id. The value source is unchanged: it still comes from DatabricksConfig.setWorkspaceId() (or the DATABRICKS_WORKSPACE_ID environment variable).

Why

On unified Databricks hosts that serve multiple workspaces, the SDK sends a routing header on every workspace-scoped HTTP request so the gateway can dispatch it to the correct workspace. Until now that header was X-Databricks-Org-Id.

The Databricks platform is consolidating workspace addressing onto a single header, X-Databricks-Workspace-Id, which accepts a broader range of workspace identifier formats and replaces the older single-purpose channels going forward. The previous header continues to be accepted by the platform, so older SDK versions keep working, but new SDK versions should use the new name.

This PR is the Java SDK's part of that migration.

What changed

Interface changes

None. DatabricksConfig#workspaceId keeps the same field name, type (String), accessors, and environment variable (DATABRICKS_WORKSPACE_ID). The Javadoc is widened to note that the value may now be either a classic numeric workspace ID or another workspace identifier format that the server understands.

Behavioral changes

  • Workspace-scoped requests no longer send X-Databricks-Org-Id. They now send X-Databricks-Workspace-Id (with the same value, gated on apiClient.workspaceId() being non-null). Account-scoped requests are unaffected.

Internal changes

  • Regenerated every *Impl.java under databricks-sdk-java/src/main/java/com/databricks/sdk/service/*/ and the test fixtures under databricks-sdk-java/src/test/java/com/databricks/sdk/service/{httpcallv2,idempotencytesting,jsonmarshallv2,lrotesting}/ from the corresponding generator template change: 149 files, 961 line swaps — symmetric, no logic change.
  • Updated hand-written sites the generator does not cover: the deprecated SCIM v1 impls (GroupsImpl, ServicePrincipalsImpl, UsersImpl) and the SharesExtImpl extension for /api/2.1/unity-catalog/shares.
  • Updated the X-Databricks-Org-Id reference inside the UnifiedHostWorkspaceIT comment so the comment matches the new code.

How is this tested?

  • make fmt and mvn clean test pass locally. Full unit suite is green (1376 passed, 0 failed).
  • Spot-checked the regenerated diff: every changed line is exclusively the header literal swap; no collateral changes.

Mirrors databricks/databricks-sdk-go#1688.

Mechanical regen of every `*Impl.java` after the `javasdkv0` template was
updated to emit `X-Databricks-Workspace-Id` in place of `X-Databricks-Org-Id`
on workspace-scoped operations. 149 files, 961 insertions / 961 deletions —
symmetric swap with no logic change.

Account-scoped impls are unaffected; the conditional gate (`if not
.Service.IsAccounts`) and value source (`apiClient.workspaceId()`) are
unchanged.

Signed-off-by: Divyansh Vijayvergia <divyansh.vijayvergia@databricks.com>
Covers the sources the Java SDK generator does not touch:

* Deprecated SCIM v1 impls (GroupsImpl, ServicePrincipalsImpl, UsersImpl)
  retain a codegen marker but are maintained by hand.
* SharesExtImpl, the hand-written extension for
  `/api/2.1/unity-catalog/shares`.
* The X-Databricks-Org-Id literal in the UnifiedHostWorkspaceIT comment.
* DatabricksConfig.workspaceId Javadoc widened to note the value accepts
  either a classic numeric workspace ID or another workspace identifier
  format that the server understands.
* NEXT_CHANGELOG.md entry under Internal Changes.

Signed-off-by: Divyansh Vijayvergia <divyansh.vijayvergia@databricks.com>
@github-actions
Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-java

Inputs:

  • PR number: 805
  • Commit SHA: 328e300cb13164b55a56d03d7a1ec0e2b9b31060

Checks will be approved automatically on success.

@Divyansh-db Divyansh-db requested a review from hectorcast-db May 22, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant