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

Add example to demonstrate using a custom sys.path #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pietern
Copy link
Contributor

@pietern pietern commented Oct 15, 2024

No description provided.

"import sys\n",
"from databricks.sdk.runtime import dbutils\n",
"bundle_file_path = dbutils.widgets.get(\"bundle_file_path\")\n",
"sys.path.append(bundle_file_path)"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious if this solves the customer problem. But there's another approach here where you could support interactive execution as well: you could have a %run ./add-sys-path here. The add-sys-path would then be a notebook that does something like https://github.com/databricks/bundle-examples/blob/main/default_python/fixtures/.gitkeep#L11 to add its containing folder to the sys path.

"outputs": [],
"source": [
"import sys\n",
"from databricks.sdk.runtime import dbutils\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to import dbutils from the SDK here? It seems like this notebook will only be run from the workspace.

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