Skip to main content

cli and sdk to manage Jobs in Databricks

Project description

fish-databricks-jobs

fish-databricks-jobs is cli and python sdk to manage Jobs for Databricks. e.g assign permissions to multiple jobs. User can filter jobs by job name or tags.

The functionality of current databricks-cli(v0.17.4) is limited on the jobs api. e.g it can not assign job permission.

With fish-databricks-jobs, you can assign job permission, e.g:

to assign group mygroup with permission can_manage to job by filter 843966944901662(job_id)

$ fish-databricks-jobs permission-assign mygroup --type group --level can_manage --filter 843966944901662

Installation

Python Version >= 3.7

$ pip install --upgrade fish-databricks-jobs
$ fish-databricks-jobs --version
Version: 0.6.8

Usage

permission-assign

$ fish-databricks-jobs permission-assign -h

 Usage: fish-databricks-jobs permission-assign [OPTIONS] NAME

 Assign permission to user

╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    name      TEXT  User name, group name or serive principal id. Who will receive the permisssion. [default: None]    │
│                      [required]                                                                                         │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│    --type     -t      [user|principal|group]                Permission receiver type. [default: user]                   │
│ *  --level    -l      [can_view|can_manage|can_manage_run]  Permission level. [default: None] [required]                │
│    --filter   -f      TEXT                                  filter jobs, case insensitively. [default: None]            │
│    --profile  -p      TEXT                                  profile name in ~/.databrickscfg [default: DEFAULT]         │
│    --force                                                  Attempt to assign permission without prompting for          │
│                                                             confirmation. **Use this flag with caution**                │
│    --help     -h                                            Show this message and exit.                                 │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

use as sdk to list jobs

in databricks' notebook

%pip install fish-databricks-jobs
from fish_databricks_jobs.services.jobs import JobsService, Job
host = f'https://{spark.conf.get("spark.databricks.workspaceUrl")}'
token = 'exampletokenc0e27d8b91fd8c0144f0a23'

job_list = JobsService(host, token).list()
df = spark.createDataFrame(job_list)

display(df)

Config authentication

fish-databricks-jobs uses same config file as databricks-cli. e.g.~/.databrickscfg for macOS. Similar for Windows.

[DEFAULT]
host = https://example.cloud.databricks.com
token = exampletokenc0e27d8b91fd8c0144f0a23

Developer

Setup

  1. Checkout code
  2. install poetry, e.g: in macOS or Windows-cmder
curl -sSL https://install.python-poetry.org | python -
  1. config poetry
poetry config virtualenvs.in-project true
  1. install dependencies python libraries in the venv
poetry install
poetry shell 
  1. in pycharm, Add New Interpreter -> Poetry Environment ...
  2. Verifiy
(fish-databricks-jobs-py3.8) (base) username@macbook:~/projects/fish-databricks-jobs [main] 
$ python ./fish_databricks_jobs/cli.py --version
Version: 0.7.6

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

fish_databricks_jobs-0.7.11.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

fish_databricks_jobs-0.7.11-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file fish_databricks_jobs-0.7.11.tar.gz.

File metadata

  • Download URL: fish_databricks_jobs-0.7.11.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for fish_databricks_jobs-0.7.11.tar.gz
Algorithm Hash digest
SHA256 af01c612fc9fb0b59977d708bbef4c7f24f263b4645989f6bb055bfceaf92c67
MD5 b08c9f3affcdc2b2b1e76af1bf42347f
BLAKE2b-256 c6a5cc946f16a3198281c93f1d08812723f3e8634d909ff2dea87722f7bda093

See more details on using hashes here.

File details

Details for the file fish_databricks_jobs-0.7.11-py3-none-any.whl.

File metadata

  • Download URL: fish_databricks_jobs-0.7.11-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for fish_databricks_jobs-0.7.11-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c87b890384e4769b68b5ea06bf34d2e17f77dc8cd8fa0ce7128bc27581c07c
MD5 40b19bcf1b3c6e09c37decc482641c88
BLAKE2b-256 21eada510bf472f155f31cc6f519c2c91662cce543f2608762b114b69ea24b60

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