Production-focused Databricks API toolkit by Rehla Digital Inc for workspace and account automation on AWS.
Project description
Unified Databricks API
Single Python package to call Databricks Workspace and Account APIs and convert JSON responses into Pandas or PySpark DataFrames.
About Rehla Digital Inc
Rehla Digital Inc builds cloud and data engineering solutions that help teams standardize platform operations, accelerate delivery, and reduce integration risk. This package is maintained as part of that effort to provide a practical, production-oriented Databricks API toolkit.
Install
pip install rehla-dbx-tools
Import in Python with underscores:
from rehla_dbx_tools import DatabricksApiClient
Install Spark extras if needed:
pip install "rehla-dbx-tools[spark]"
Quick Start
from rehla_dbx_tools import DatabricksApiClient
client = DatabricksApiClient.from_env()
if client.workspace is not None:
jobs = client.workspace.list_jobs()
df = jobs.to_pandas()
print(df.head())
# Force both workspace/account config to a target cloud
client = DatabricksApiClient.from_env_for_cloud("azure")
Simple host/token setup:
from rehla_dbx_tools import DatabricksApiClient
client = DatabricksApiClient.simple(
host="https://dbc-xxxx.cloud.databricks.com",
token="dapi...token...",
)
jobs = client.list_jobs(limit=25)
print("jobs:", len(jobs))
for run in client.list_recent_job_runs(limit=25):
print(run.get("run_id"))
Token can be omitted if you want guided auth:
client = DatabricksApiClient.simple(
host="https://dbc-xxxx.cloud.databricks.com",
open_browser_for_token=True, # opens Access Tokens page
prompt_for_token=True, # prompts to paste token
)
Windows SSO flow (Databricks CLI login):
client = DatabricksApiClient.from_windows_sso(
host="https://dbc-xxxx.cloud.databricks.com",
)
Notebook Context Bootstrap
Inside Databricks notebooks:
from rehla_dbx_tools import DatabricksApiClient
client = DatabricksApiClient.from_notebook_context()
if client.workspace is not None:
clusters = client.workspace.list_clusters()
spark_df = clusters.to_spark()
display(spark_df)
Account API
account client is enabled when DATABRICKS_ACCOUNT_HOST and DATABRICKS_ACCOUNT_ID are set.
if client.account is not None:
workspaces = client.account.list_workspaces()
print(workspaces.to_pandas().head())
Version-Aware Generic Request
response = client.workspace.request_versioned(
"GET",
service="unity-catalog",
endpoint="metastores",
api_version="2.1",
)
Read-Only Package Mode
This package build is read-only by design:
- Destructive HTTP methods (
POST,PATCH,PUT,DELETE) are blocked. - GET requests force pagination aggregation for DataFrame-first workflows.
Version and help metadata
import rehla_dbx_tools as rdt
print(rdt.__version__)
print(rdt.__Help__)
Available read-only tools
Workspace (client.workspace):
list_jobs,get_joblist_job_runs,get_job_run,get_job_run_output,export_job_runget_job_permissions,get_job_permission_levelslist_clusters,get_cluster,cluster_eventsget_cluster_permissions,get_cluster_permission_levelslist_catalogs,list_schemas,get_catalog,get_schemalist_sql_warehouses,get_sql_warehouselist_instance_pools,get_instance_poollist_cluster_policies,get_cluster_policylist_dbfs,get_dbfs_status,read_dbfslist_repos,get_repolist_secret_scopeslist_tokens
Client-level convenience:
list_jobslist_recent_job_runslist_active_job_runs
Account (client.account):
list_workspaces,get_workspacelist_credentialslist_storage_configurationslist_networkslist_private_access_settingslist_vpc_endpointslist_customer_managed_keyslist_users,get_userlist_groups,get_grouplist_budget_policies,get_budget_policylist_log_delivery_configurations,get_log_delivery_configuration
For detailed setup and examples, see docs/USAGE.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rehla_dbx_tools-1.1.3.tar.gz.
File metadata
- Download URL: rehla_dbx_tools-1.1.3.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
729345f827b76ade779489f273dc7b9dd268a982c0491f02f46ff4f10aae1a1f
|
|
| MD5 |
e87e0d603d46672e52be41f2d657480b
|
|
| BLAKE2b-256 |
08445eb2942b4f081c1065b4c3eb0a7560d310d57f5173d08679f7c4483d7f1a
|
Provenance
The following attestation bundles were made for rehla_dbx_tools-1.1.3.tar.gz:
Publisher:
workflow.yml on rehladigital/rehla_dbx_tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rehla_dbx_tools-1.1.3.tar.gz -
Subject digest:
729345f827b76ade779489f273dc7b9dd268a982c0491f02f46ff4f10aae1a1f - Sigstore transparency entry: 1006635044
- Sigstore integration time:
-
Permalink:
rehladigital/rehla_dbx_tools@a763ca729f1bd089442045377226d13d78759b1e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rehladigital
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a763ca729f1bd089442045377226d13d78759b1e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file rehla_dbx_tools-1.1.3-py3-none-any.whl.
File metadata
- Download URL: rehla_dbx_tools-1.1.3-py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18d8aa249b013571d42e9d06d6d7d55f81815863af3606ba6d7b656958d3f0d8
|
|
| MD5 |
0287c25479cd061fd550e8bd442d43e5
|
|
| BLAKE2b-256 |
2c6b6ddcbac0d858cb3735d996115825a91c7b206beee584c60d53491e821fd2
|
Provenance
The following attestation bundles were made for rehla_dbx_tools-1.1.3-py3-none-any.whl:
Publisher:
workflow.yml on rehladigital/rehla_dbx_tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rehla_dbx_tools-1.1.3-py3-none-any.whl -
Subject digest:
18d8aa249b013571d42e9d06d6d7d55f81815863af3606ba6d7b656958d3f0d8 - Sigstore transparency entry: 1006635046
- Sigstore integration time:
-
Permalink:
rehladigital/rehla_dbx_tools@a763ca729f1bd089442045377226d13d78759b1e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rehladigital
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a763ca729f1bd089442045377226d13d78759b1e -
Trigger Event:
workflow_dispatch
-
Statement type: