Python Databricks API wrapper using requests module
Project description
Databricks API Documentation
This package is a Python Implementation of the Databricks API for structured and programmatic use. This Python implementation requires that your Databricks API Token be saved as an environment variable in your system: export DATABRICKS_TOKEN=MY_DATABRICKS_TOKEN
Installation
You can either use pip install databricksapi
to install it globally, or you can clone the repository. Please note that only compatability with Python 3.7+ is guaranteed.
APIs Included
- Token
- Secrets
- Clusters
- SCIM (Experimental)
- Jobs
- DBFS
- Groups
- Instance Profiles
- Libraries
- Workspace
Token API
The Token API allows any user to create, list, and revoke tokens that can be used to authenticate and access Databricks REST APIs. Initial authentication to this API is the same as for all of the Databricks API endpoints.
Methods
- createToken(lifetime_seconds, comment)
- listTokens()
- revokeToken(token_id)
createToken(lifetime_seconds, comment)
Create and return a token.
url = 'https://url.for.databricks.net'
db_api = Token(url)
db_api.createToken(600, 'Test token')
listTokens()
List all Token IDs in your Databricks Environment.
url = 'https://url.for.databricks.net'
db_api = Token(url)
db_api.listTokens()
revokeToken(token_id)
Revoke an active Databricks token.
url = 'https://url.for.databricks.net'
db_api = Token(url)
#token_id can be obtained from using the listTokens() method
db_api.revokeToken('5715498424f15ee0213be729257b53fc35a47d5953e3bdfd8ed22a0b93b339f4')
Secrets API
The Secrets API allows you to manage secrets, secret scopes, and access permissions.
Methods
- createSecretScope(scope, initial_manage_principal)
- deleteSecretScope(scope)
- listSecretScopes()
- putSeceret(value, value_type, scope, key)
- deleteSecretIscope, key)
- listSecrets(scope)
- putSecretACL(scope, principal, permission)
- deleteSecretACL(scope, principal)
- getSecretACL(*scope, principal)
- listSecretACL(scope, principal)
createSecretScope(scope, initial_manage_princial)
Creates a new secret scope.
The scope name must consist of alphanumeric characters, dashes, underscores, and periods, and may not exceed 128 characters. The maximum number of scopes in a workspace is 100.
url = 'https://url.for.databricks.net'
db_api = Token(url)
scope = 'SomeSecretScope'
initial_manage_princial = 'users'
db_api.createSecretScope(scope, initial_manage_princial)
deleteSecretScope(scope)
Delete a secret scope.
url = 'https://url.for.databricks.net'
db_api = Token(url)
scope = 'SomeSecretScope'
db_api.deleteSecretScope(scope)
listSecretScopes()
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
Hashes for databricksapi-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89e2207ebdabcd2d3b68939dcc88d2958c6dee4a6f11b97492380c7ed68543b7 |
|
MD5 | 916622d5a9423a8323bb54d84e0f0b4d |
|
BLAKE2b-256 | 6414396fc7ad48b3dbd4f21602d044ec1b5b228749da6269575aa0df18a4cfea |