Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 formpartner/<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 locallymake fmt
applied