-
Notifications
You must be signed in to change notification settings - Fork 123
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 methods to provide extra user agent and upstream user agent to sdk config #163
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #163 +/- ##
==========================================
+ Coverage 53.27% 53.31% +0.04%
==========================================
Files 30 30
Lines 18178 18194 +16
==========================================
+ Hits 9684 9700 +16
Misses 8494 8494
☔ View full report in Codecov by Sentry. |
|
||
@property | ||
def _upstream_user_agent(self) -> str: | ||
product = os.environ.get('DATABRICKS_SDK_UPSTREAM', None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also add the relevant Go SDK PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. This was a bigger priority because I would like to get dbconnect to start using this asap.
Working on go sdk today.
* Regenerate from OpenAPI spec ([#176](#176)). * Added improved notebook-native authentication ([#152](#152)). * Added methods to provide extra user agent and upstream user agent to SDK config ([#163](#163)). * Added more missing `Optional` type hints ([#171](#171)). * Add more missing optional fields ([#177](#177)). * Correctly serialize external entities ([#178](#178)). * Correctly serialize external enum values in paths ([#179](#179)). * Mark non-required fields as `Optional` ([#170](#170)). * Synchronize auth permutation tests with Go SDK ([#165](#165)).
* Regenerate from OpenAPI spec ([#176](#176)). * Added improved notebook-native authentication ([#152](#152)). * Added methods to provide extra user agent and upstream user agent to SDK config ([#163](#163)). * Added more missing `Optional` type hints ([#171](#171)). * Added more missing optional fields ([#177](#177)). * Correctly serialize external entities ([#178](#178)). * Correctly serialize external enum values in paths ([#179](#179)). * Mark non-required fields as `Optional` ([#170](#170)). * Synchronize auth permutation tests with Go SDK ([#165](#165)). ## Tests - [x] relevant integration tests applied --------- Signed-off-by: Serge Smertin <259697+nfx@users.noreply.github.com>
…854) ## Changes This PR ports databricks/databricks-sdk-py#163 to the Go SDK. This enables partners who use the SDK through a tool (like Terraform) to add custom information to the user agent without having to make code changes to the tool. Closes #850. ## Tests Added unit test to verify that the user agent is only updated when both DATABRICKS_SDK_UPSTREAM and DATABRICKS_SDK_UPSTREAM_VERSION are set. Manually ran `examples/slog` to verify that the user agent is correctly updated.
Changes
with_user_agent_extra
to allow users to specify extra user agents.DATABRICKS_SDK_UPSTREAM
andDATABRICKS_SDK_UPSTREAM_VERSION
to allow products interacting with SDK through env vars to pass their product info.Tests
make test
run locallymake fmt
applied