Skip to content

Commit

Permalink
[PROD-37531] Exposing REPL credential provider to Python SDK (#130)
Browse files Browse the repository at this point in the history
## Changes
In previous [PR](https://github.com/databricks/universe/pull/316192), we
expose a function that will be used by Python SDK's
`runtime_native_auth` so that in notebook environment it directly access
information from command execution to authenticate. This PR import it
from Python runtime to put on last piece of puzzle.

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [ ] `make test` run locally
- [x] `make fmt` applied
- [x] relevant integration tests applied
  • Loading branch information
dby-tmwctw authored Jun 1, 2023
1 parent 1e3612d commit ebb71c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion databricks/sdk/runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# available to be imported from databricks.sdk.runtime.globals. This import can be used
# in Python modules so users can access these objects from Files more easily.
dbruntime_objects = [
"display", "displayHTML", "dbutils", "table", "sql", "udf", "getArgument", "sc", "sqlContext", "spark"
"display", "displayHTML", "dbutils", "table", "sql", "udf", "getArgument", "sc", "sqlContext", "spark",
"init_runtime_native_auth"
]

RuntimeAuth = Tuple[str, Callable[[], Dict[str, str]]]
Expand All @@ -23,6 +24,8 @@ def init_runtime_native_auth() -> RuntimeAuth:
userNamespaceGlobals = UserNamespaceInitializer.getOrCreate().get_namespace_globals()
_globals = globals()
for var in dbruntime_objects:
if var not in userNamespaceGlobals:
continue
_globals[var] = userNamespaceGlobals[var]
is_local_implementation = False
except ImportError:
Expand Down

0 comments on commit ebb71c5

Please sign in to comment.