-
Notifications
You must be signed in to change notification settings - Fork 131
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
Create a deepcopy of config in api client #172
Conversation
databricks/sdk/__init__.py
Outdated
|
||
@property | ||
def config(self): | ||
return deepcopy(self._config) |
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.
i'm not sure it's a good thing. w.config.authenticate()
should reuse the same refresh token
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.
Riggghttt. Completely forgot about this. We can atleast restrict the initial config form being passed around. If they directly reuse config from client, or edit it, atleast they know why stuff is changing.
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.
i'm still not sure that we should do it this way. if we want to prevent config from being modified, we can add these in Config:
self._init_auth()
self._initialized = True
and these in ConfigAttribute
:
def __set__(self, cfg: 'Config', value: any):
if cfg._initialized: raise ValueError(...)
cfg._inner[self.name] = self.transform(value)
and test in in DBR for dbr-native auth
main.py
Outdated
from databricks.connect import DatabricksSession | ||
from databricks.sdk.core import Config | ||
|
||
config = Config(host='https://x', token='x', product="xapp", product_version="0.0.0") |
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.
please remove this file
Signed-off-by: Kartik Gupta <88345179+kartikgupta-db@users.noreply.github.com>
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #172 +/- ##
==========================================
+ Coverage 53.28% 53.30% +0.01%
==========================================
Files 30 30
Lines 18344 18350 +6
==========================================
+ Hits 9775 9781 +6
Misses 8569 8569
☔ View full report in Codecov by Sentry. |
* Added Sphinx documentation ([#184](#184), [#191](#191), [#183](#183), [#193](#193)). * Integrated with ReadTheDocs service ([#188](#188), [#189](#189), [#190](#190)). * Create a deepcopy of config in api client ([#172](#172)). * Fix client/secret auth ([#186](#186)). * Increase DBFS copy buffer size ([#185](#185)). * Move classes to other repository ([#192](#192)). * Relax `requests` version upper bound to <3 ([#138](#138)).
## Changes * Modification to template to regenerate the change made in #172 * Use fully qualified type names instead of aliasing them on import (e.g. `compute.ComputeSpec`) * Update integration tests to accommodate type name changes in the spec. Spec: 8687781fe17d83694a0c67396e04c70830b0d398 (2023-06-23) Type renames: * `compute.BaseClusterInfo -> compute.ClusterSpec` * `compute.ClusterInfo -> compute.ClusterDetails` * `jobs.JobTaskSettings -> jobs.Task` * `jobs.RunSubmitTaskSettings -> jobs.SubmitTask` * `jobs.JobWebhookNotifications -> jobs.WebhookNotifications` * `jobs.CreateJobFormat -> jobs.Format` * `jobs.GitSourceGitProvider -> jobs.GitProvider` * `jobs.FileArrivalTriggerSettings -> jobs.FileArrivalTriggerConfiguration` ## Tests - [x] `make test` run locally - [x] `make fmt` applied - [x] relevant integration tests applied
Changes
make test
run locallymake fmt
applied