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

[PROD-37531] Exposing REPL credential provider to Python SDK #130

Merged

Conversation

dby-tmwctw
Copy link
Contributor

@dby-tmwctw dby-tmwctw commented May 26, 2023

Changes

In previous PR, 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

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

@codecov-commenter
Copy link

codecov-commenter commented May 26, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01 ⚠️

Comparison is base (1e3612d) 53.01% compared to head (36d0562) 53.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #130      +/-   ##
==========================================
- Coverage   53.01%   53.00%   -0.01%     
==========================================
  Files          29       29              
  Lines       17568    17570       +2     
==========================================
  Hits         9313     9313              
- Misses       8255     8257       +2     
Impacted Files Coverage Δ
databricks/sdk/runtime/__init__.py 65.21% <0.00%> (-6.22%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if init_runtime_native_auth is not present in the userNamespaceGlobals in the old DBR versions? please add if var not in userNamespaceGlobals: continue, otherwise SDK might crash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nfx I will add it. However, when I test this against DBR 12.2 LTS (which definitely doesn't have init_runtime_native_auth), it doesn't actually crash. That is surprising considering that if I run this in notebook, it raise a KeyError as expected. Do you have any idea why this is the case? Just curious.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a mystery :)

Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgttm

@@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a mystery :)

@nfx nfx merged commit ebb71c5 into databricks:main Jun 1, 2023
@nfx nfx mentioned this pull request Jun 9, 2023
nfx added a commit that referenced this pull request Jun 9, 2023
# Version changelog

## 0.1.9

* Added new services from OpenAPI spec
([#145](#145),
[#159](#159)).
* Added consistent usage of the `upload(path, IO)` and `download(path)
-> IO` across file-related operations
([#148](#148)).
* Added Databricks Metadata Service credential provider
([#139](#139),
[#130](#130)).
* Added exposing runtime credential provider without changing user
namespace
([#140](#140)).
* Added a check for `is not None` for primitive fields in `as_dict()`
([#147](#147)).
* Fixed bug related to boolean flags and convert `True` to `true` in
query strings
([#156](#156)).
* Fixed generation of external entities
([#146](#146)).
* Make u2m authentication work with new CLI
([#150](#150)).
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.

3 participants