-
Notifications
You must be signed in to change notification settings - Fork 130
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
Make workspace client also return runtime dbutils when in dbr #210
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f95fe7a
Make workspace client also return runtime dbutils when in dbr
kartikgupta-db 7e7f77f
remove unused imports
kartikgupta-db 80be442
remove unused imports
kartikgupta-db c508af1
remove unused imports
kartikgupta-db 3870318
Merge branch 'main' into fallback-dbutils-apiclient
kartikgupta-db 3555639
revert settings.json
kartikgupta-db 6436051
Merge branch 'fallback-dbutils-apiclient' of github.com:databricks/da…
kartikgupta-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
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 the intended behavior, as we want to migrate users away from dbutils to SDK. this PR makes people assume that dbutils will stay there forever
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.
Agreed. But there is a currently a huge functionality gap between the sdk implementation and dbutils on runtime.
from databricks.sdk.runtime import *
and workspace_client.dbutils) provide different implementations can be confusing for the user.If we are ok with putting the responsibility on the user to understand what dbutils they are using (1.), we can address 2 by selectively proxying to the dbr dbutils when in dbr (instead of using command exec or different implementations for widgets).
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.
@xiaochen-db @falaki - what do you guys think?
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.
Sounds like we are reversing from the former direction where REPL should eventually adopt the SDK dbutils despite current function gaps to maintaining two versions of dbutils: the SDK one and the DBR one, and SDK one will fall back on DBR if it's used in a REPL.
I am okay with that given that the function gaps seem unresolvable in the near term. My another question is that why do you only update the dbutils from
WorkspaceClient
? Is there other way for a user to createdbutils.RemoteDbUtils(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.
We expose dbutils through 2 paths
from databricks.sdk.runtime import *
The first one already falls back to the dbr version of dbutils. WorkspaceClient does not.
Good point about
dbutils.RemoteDbUtils(config)
. It is possible. It currently looks like thisWe should rename this to
_dbutils
to make it clear that this is an internal implementation, and users are not expected to initialise it. Wdyt @nfx ?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 we also please type hint the return type of this correctly?
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.
@judahrand this will already work with the changes you made. This will return a union of types, which will include the full typing information you added to sdk.runtime
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 meant type hinting in the code 🤷♂️ No reason not to properly type hint all Python code these days.
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.
This function is still missing a return type annotation 😢
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.
@judahrand it is difficult to type this function, because we cannot know what type of dbutils to use (the dbr or the OSS one) until we actually try importing dbutils from dbr. So this function can't be typed until this function runs.
We do not want to mess with dbr typing.