Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_workspace_id to WorkspaceClient #537

Merged
merged 7 commits into from
Feb 9, 2024
Merged

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented Feb 8, 2024

Changes

There are times when it is especially useful to get the workspace ID for the current workspace client. Currently, the workspace ID for the current workspace is exposed as a header in the SCIM Me API call. We'll expose this through a get_workspace_id() method, caching the workspace ID for the lifetime of the client.

In the future, we may add a meta service for exposing information about the current account/workspace. At that point, we can migrate off of this somewhat hacky approach.

Ports databricks/databricks-sdk-go#808 to the Python SDK.

Tests

  • make test run locally
  • make fmt applied
  • relevant integration tests applied

@codecov-commenter
Copy link

codecov-commenter commented Feb 9, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (09aa3e9) 57.89% compared to head (a6bcdc6) 57.92%.

Files Patch % Lines
databricks/sdk/__init__.py 33.33% 2 Missing ⚠️
databricks/sdk/core.py 81.81% 2 Missing ⚠️
databricks/sdk/casing.py 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #537      +/-   ##
==========================================
+ Coverage   57.89%   57.92%   +0.03%     
==========================================
  Files          44       45       +1     
  Lines       27956    27988      +32     
==========================================
+ Hits        16185    16213      +28     
- Misses      11771    11775       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mgyucht mgyucht added this pull request to the merge queue Feb 9, 2024
Merged via the queue into main with commit 85ba774 Feb 9, 2024
9 checks passed
@mgyucht mgyucht deleted the add-get-workspace-id branch February 9, 2024 16:10
mgyucht added a commit that referenced this pull request Feb 15, 2024
This is a patch release with two small changes:

* Add `get_workspace_id()` to WorkspaceClient ([#537](#537)).

Bugfix:

* Create a deepcopy of config when creating workspace client from account client ([#542](#542)). This fixes an issue where `AccountClient` instances would stop working after calling `get_workspace_client()`.
mgyucht added a commit that referenced this pull request Feb 15, 2024
New features:

* Add `get_workspace_id()` to WorkspaceClient ([#537](#537)).

Bugfix:

* Create a deepcopy of config when creating workspace client from account client ([#542](#542)). This fixes an issue where `AccountClient` instances would stop working after calling `get_workspace_client()`.
@mgyucht mgyucht mentioned this pull request Feb 15, 2024
github-merge-queue bot pushed a commit that referenced this pull request Feb 15, 2024
New features:

* Add `get_workspace_id()` to WorkspaceClient
([#537](#537)).

Bugfix:

* Create a deepcopy of config when creating workspace client from
account client
([#542](#542)). This
fixes an issue where `AccountClient` instances would stop working after
calling `get_workspace_client()`.
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.

3 participants