Skip to content

Instantly share code, notes, and snippets.

@tonio-m
Created December 6, 2024 19:18
Show Gist options
  • Select an option

  • Save tonio-m/dee704c40525e119f12b3b90b6411e7d to your computer and use it in GitHub Desktop.

Select an option

Save tonio-m/dee704c40525e119f12b3b90b6411e7d to your computer and use it in GitHub Desktop.
create a repl inside a databricks cluster. for terminal development
from prompt_toolkit import prompt
from databricks.sdk import WorkspaceClient
from databricks.sdk.service import compute
w = WorkspaceClient()
cluster_id = 'existing-cluster-id'
new_context = w.command_execution.create(cluster_id=cluster_id, language=compute.Language.python).result()
while True:
cmd = prompt("databricks>")
response = w.command_execution.execute(cluster_id=cluster_id, context_id=new_context.id, language=compute.Language.python, command=cmd).result()
print(response.results.data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment