Skip to main content

Run databricks operations across multiple workspaces from a single terse CLI.

Project description

sleepybricks

sleepybricks is a succinct Typer-based CLI that wraps the databricks SDK to run operations across multiple workspaces at once.

It authenticates by reading profiles from ~/.databrickscfg (the same file the databricks CLI uses) and gives a graceful error when that file or a requested profile is missing.

Authentication

Every command takes a comma-separated profile_list (e.g. dev,stg,us) naming profiles defined in ~/.databrickscfg. Create that file with the databricks CLI if you don't have one:

databricks configure --token   # repeat once per workspace/profile

Install

Install the CLI globally with uv:

uv tool install sleepybricks

Commands

Command Description
dash-links <dashboard_name> <profiles> Print the published link for a dashboard in each workspace.
sql -s "<sql>" <profiles> / sql -f <file.sql> <profiles> Execute raw sql or a file on the serverless warehouse set in sleepyconfig.
write-secret <scope> <key> <value> <profiles> Write a secret into an existing scope in each workspace.
write-secret <scope>.<key> <value> <profiles> Same, using the dotted shorthand.
create-scope <scope_name> <profiles> Create a secret scope in each workspace (skips existing).
pull-repo <repo_name> <profiles> Pull the latest commit for a git repo in each workspace.
create-workspace-folder <folder_name> <profiles> Create a workspace folder in each workspace (skips existing).
sleepybricks dash-links "Scheduled Triage Device Metrics" "dev,eu"
sleepybricks sql -s "select * from my_tbl" "dev,stg,us"
sleepybricks sql -f "./query.sql" "dev,stg"
sleepybricks write-secret my_scope.api_key "s3cret" "dev,stg"
sleepybricks pull-repo databricks_templates "dev,stg,us"
sleepybricks create-workspace-folder databricks_templates "dev,stg,us"
sleepybricks --help

Dashboard names are matched case-sensitively and are not unique in databricks; the first match per workspace is used and a warning is shown when duplicates exist. The sql command needs a serverless SQL warehouse in each workspace — see Configuration below.

Configuration

sleepybricks is a sleepy util and reads shared settings from ~/sleepyconfig/params.yml. On first run the file is created with defaults and a note is printed to the console. Relevant keys:

  • bricks_table_styletabulate table style used for all output (e.g. simple, rounded_grid, github).
  • serverless_warehouse_name — name of the serverless SQL warehouse used for compute. The <env> token is replaced with the active profile name, so the default <env>_serverless_warehouse resolves to dev_serverless_warehouse for the dev profile. Use a static value (no token) if your warehouse name is the same everywhere.
  • env_emojis — per-profile emoji used to decorate output labels.
  • display_names — per-profile friendly name used in output labels.
# sleepybricks
bricks_table_style: simple
serverless_warehouse_name: <env>_serverless_warehouse
env_emojis:
  dev: "👩‍💻"
  stg: "🔧"
  us: "🇺🇸"
display_names:
  dev: "Development"
  stg: "Staging"
  us: "United States"

Development

Create the environment and install in editable mode with uv:

uv venv
uv pip install -e ".[dev]"

Then run uv run pytest, or ./tools/test.sh. Tests use fakes for the databricks client and never touch a real workspace. Tear down with rm -rf .venv.

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sleepybricks-1.0.0.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sleepybricks-1.0.0-py3-none-any.whl (44.3 kB view details)

Uploaded Python 3

File details

Details for the file sleepybricks-1.0.0.tar.gz.

File metadata

  • Download URL: sleepybricks-1.0.0.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.5 Darwin/25.5.0

File hashes

Hashes for sleepybricks-1.0.0.tar.gz
Algorithm Hash digest
SHA256 986bf33207213cb1e77b25a33b0272a4f87d71a2f76c4eba487273f9994cf116
MD5 198fa852e5779b28c406960db000b9c7
BLAKE2b-256 515be43d0a3ca445c2efdb6a0fb320c3f2d9fcfd80b8fde4fc7909394adff251

See more details on using hashes here.

File details

Details for the file sleepybricks-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sleepybricks-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 44.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.5 Darwin/25.5.0

File hashes

Hashes for sleepybricks-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea4d308c9daefc35661bbfb0b87a3a95242ade9742f0c1267df6eb4416fbaf5d
MD5 905b1b57c2cb5d45fc65b8a396071e2e
BLAKE2b-256 c30ba32e99712ff397dbc8f6949ac43fc19aebe371aac7f31d23ed34d4d29151

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page