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

Support partners in SDK #648

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Support partners in SDK #648

wants to merge 5 commits into from

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented May 17, 2024

Changes

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

Partners of Databricks need a mechanism to register themselves in libraries or applications that they write. In this way, requests made by users of those libraries will include sufficient information to link those requests to the original users.

This PR adds a new function with_partner that can be used by a partner to add partner information to the User-Agent header for requests made by the SDK. The new header will have the form partner/<parther id>. The partner identifier is opaque for the SDK, but it must be alphanumeric.

This PR also removes the requirement that a user agent entry contain only a single copy of each key. This allows multiple partners to register in the same library or application.

In this PR, I've also refactored the user agent library to be more static, aligning it with the Go and Java SDKs. This makes it easier to maintain & ensures similar behavior between all 3 SDKs. Note that there is extra functionality in this SDK that doesn't exist in the Go and Java SDKs, namely config-level user agent info; that is preserved in here.

Tests

Unit tests were added to verify user agent contains all expected parts, and that the user agent supports multiple partners.

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

@mgyucht mgyucht changed the title partner integration Support partners in SDK May 17, 2024
Copy link

github-actions bot commented May 17, 2024

This PR breaks backwards compatibility for databrickslabs/blueprint downstream. See build logs for more details.

Running from downstreams #128

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 93.22034% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 57.69%. Comparing base (b13042b) to head (e0a8991).

Files Patch % Lines
databricks/sdk/user_agent.py 94.54% 3 Missing ⚠️
databricks/sdk/config.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #648      +/-   ##
==========================================
+ Coverage   57.66%   57.69%   +0.03%     
==========================================
  Files          48       49       +1     
  Lines       32680    32717      +37     
==========================================
+ Hits        18844    18877      +33     
- Misses      13836    13840       +4     

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

@mgyucht mgyucht requested a review from tanmay-db May 17, 2024 15:21
# Conflicts:
#	databricks/sdk/config.py
#	tests/test_config.py
@mgyucht mgyucht enabled auto-merge June 7, 2024 15:08
Copy link

github-actions bot commented Jun 7, 2024

This PR breaks backwards compatibility for databrickslabs/ucx downstream. See build logs for more details.

Running from downstreams #166

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.

None yet

3 participants