das package

Subpackages

Submodules

das.credential module

class das.credential.AzureDatabricksCredential

Bases: _AzureBaseCredential

Credential for Azure Databricks REST API using Service Principal.

Methods

get_headers()

get_headers method

class das.credential.AzureFunctionCredential

Bases: _AzureBaseCredential

Credential for invoking functions in Azure Functions using Service Principal.

Methods

get_headers()

get_headers method

class das.credential.BearerToken(token)

Bases: _BaseToken

Token for Bearer-type Authorization header.

Returned header example: Authorization: Bearer some-token-here

Methods

get_headers()

Implement this method in inherited classes.

get_headers()

Implement this method in inherited classes.

class das.credential.FunctionToken(token)

Bases: _BaseToken

Token to be used with (e.g.) Azure Functions application and function key.

Get token from configured function-app and paste it in initialization,

Returned header example: x-functions-key: some-token-here

Methods

get_headers()

Implement this method in inherited classes.

get_headers()

Implement this method in inherited classes.

das.databricks_client module

class das.databricks_client.DatabricksClient(host=None, token=None, config_name='config.ini')

Bases: DatabricksAPI

Databricks API client wrapper that initializes the client with endpoint and credentials.

Attributes
api_token

Databricks API personal access token or compatible OAuth2 access token.

host

Base URL of the Databricks API.

Methods

get_ad_token(config_name)

Login to Databricks API using Azure client credentials.

property api_token

Databricks API personal access token or compatible OAuth2 access token.

get_ad_token(config_name)

Login to Databricks API using Azure client credentials.

Parameters
config_namestr

Optional parameter to tell the file name of the config file.

property host

Base URL of the Databricks API.

das.functions_client module

class das.functions_client.AzureFunctionsClient(client_id=None, client_secret=None, tenant_id=None, subscription_id=None, resource_group=None, function_app=None, config_name='config.ini')

Bases: object

Lite client for Azure Functions (function-app) API calls.

Methods

get_function(function_name[, ...])

Parameters

list_functions([resource_group, function_app])

Get information of functions in a function app in Azure.

login([client_id, client_secret, scope])

Authenticate to Azure.

logout()

Logout from Azure.

get_function(function_name, resource_group=None, function_app=None)
Parameters
function_namestr

The function name to get the information of.

resource_groupstr

Name of the resource group to which the resource belongs. Can be given in the initialization of this class, but can be overridden with this parameter.

function_appstr

Name of the function app that the function belongs to. Can be given in the initialization of this class, but can be overridden with this parameter.

Returns
dict

Function information in json form.

Raises
HTTPError

If request was errored. Raised by response.raise_for_status()

list_functions(resource_group=None, function_app=None)

Get information of functions in a function app in Azure.

Parameters
resource_groupstr

Name of the resource group to which the resource belongs. Can be given in the initialization of this class, but can be overridden with this parameter.

function_appstr

Name of the function app that the function belongs to. Can be given in the initialization of this class, but can be overridden with this parameter.

Returns
dict

Function information in json form.

Raises
HTTPError

If request was errored. Raised by response.raise_for_status().

login(client_id=None, client_secret=None, scope=None)

Authenticate to Azure. This must be called if user is not in an environment where the authentication can be done automatically so that the environment variables are set.

Parameters
client_idstr
client_secretstr

Azure client credentials.

scopestr

Optional scope for the authentication. If not given, the default scope will be used.

logout()

Logout from Azure.

Module contents