The main API client#

The dataikuapi.DSSClient class is the entry point for many of the capabilities of the Dataiku API.

class dataikuapi.DSSClient(host, api_key=None, internal_ticket=None, extra_headers=None, insecure_tls=False)#

Entry point for the DSS API client

list_futures(as_objects=False, all_users=False)#

List the currently-running long tasks (a.k.a futures)

Parameters:
  • as_objects (boolean) – if True, each returned item will be a dataikuapi.dss.future.DSSFuture

  • all_users (boolean) – if True, returns futures for all users (requires admin privileges). Else, only returns futures for the user associated with the current authentication context (if any)

Returns:

list of futures. if as_objects is True, each future in the list is a dataikuapi.dss.future.DSSFuture. Else, each future in the list is a dict. Each dict contains at least a ‘jobId’ field

Return type:

list of dataikuapi.dss.future.DSSFuture or list of dict

list_running_scenarios(all_users=False)#

List the running scenarios

Parameters:

all_users (boolean) – if True, returns scenarios for all users (requires admin privileges). Else, only returns scenarios for the user associated with the current authentication context (if any)

Returns:

list of running scenarios, each one as a dict containing at least a “jobId” field for the future hosting the scenario run, and a “payload” field with scenario identifiers

Return type:

list of dicts

get_future(job_id)#

Get a handle to interact with a specific long task (a.k.a future). This notably allows aborting this future.

Parameters:

job_id (str) – the identifier of the desired future (which can be returned by list_futures() or list_running_scenarios())

Returns:

A handle to interact the future

Return type:

dataikuapi.dss.future.DSSFuture

list_running_notebooks(as_objects=True)#

List the currently-running Jupyter notebooks

Parameters:

as_objects (boolean) – if True, each returned item will be a dataikuapi.dss.notebook.DSSNotebook

Returns:

list of notebooks. if as_objects is True, each entry in the list is a dataikuapi.dss.notebook.DSSNotebook. Else, each item in the list is a dict which contains at least a “name” field.

Return type:

list of dataikuapi.dss.notebook.DSSNotebook or list of dict

get_root_project_folder()#

Get a handle to interact with the root project folder.

Returns:

A dataikuapi.dss.projectfolder.DSSProjectFolder to interact with this project folder

get_project_folder(project_folder_id)#

Get a handle to interact with a project folder.

Parameters:

project_folder_id (str) – the project folder ID of the desired project folder

Returns:

A dataikuapi.dss.projectfolder.DSSProjectFolder to interact with this project folder

list_project_keys()#

List the project keys (=project identifiers).

Returns:

list of project keys identifiers, as strings

Return type:

list of strings

list_projects()#

List the projects

Returns:

a list of projects, each as a dict. Each dictcontains at least a ‘projectKey’ field

Return type:

list of dicts

get_project(project_key)#

Get a handle to interact with a specific project.

Parameters:

project_key (str) – the project key of the desired project

Returns:

A dataikuapi.dss.project.DSSProject to interact with this project

get_default_project()#

Get a handle to the current default project, if available (i.e. if dataiku.default_project_key() is valid)

create_project(project_key, name, owner, description=None, settings=None, project_folder_id=None)#

Creates a new project, and return a project handle to interact with it.

Note: this call requires an API key with admin rights or the rights to create a project

Parameters:
  • project_key (str) – the identifier to use for the project. Must be globally unique

  • name (str) – the display name for the project.

  • owner (str) – the login of the owner of the project.

  • description (str) – a description for the project.

  • settings (dict) – Initial settings for the project (can be modified later). The exact possible settings are not documented.

  • project_folder_id (str) – the project folder ID in which the project will be created (root project folder if not specified)

Returns:

A dataikuapi.dss.project.DSSProject project handle to interact with this project

list_apps(as_type='listitems')#

List the apps.

Parameters:

as_type (str) – How to return the list. Supported values are “listitems” and “objects” (defaults to listitems).

Returns:

The list of the apps. If “as_type” is “listitems”, each one as a dataikuapi.dss.app.DSSAppListItem. If “as_type” is “objects”, each one as a dataikuapi.dss.app.DSSApp

Return type:

list

get_app(app_id)#

Get a handle to interact with a specific app.

Note

If a project XXXX is an app template, the identifier of the associated app is PROJECT_XXXX

Parameters:

app_id (str) – the id of the desired app

Returns:

A dataikuapi.dss.app.DSSApp to interact with this project

list_plugins()#

List the installed plugins

Returns:

list of dict. Each dict contains at least a ‘id’ field

download_plugin_stream(plugin_id)#

Download a development plugin, as a binary stream :param str plugin_id: identifier of the plugin to download

Parameters:

plugin_id

Returns:

the binary stream

download_plugin_to_file(plugin_id, path)#

Download a development plugin to a file

Parameters:
  • plugin_id (str) – identifier of the plugin to download

  • path (str) – the path where to download the plugin

Returns:

None

install_plugin_from_archive(fp)#

Install a plugin from a plugin archive (as a file object)

Parameters:

fp (object) – A file-like object pointing to a plugin archive zip

start_install_plugin_from_archive(fp)#

Install a plugin from a plugin archive (as a file object) Returns immediately with a future representing the process done asycnhronously

Parameters:

fp (object) – A file-like object pointing to a plugin archive zip

Returns:

A DSSFuture representing the install process

Return type:

DSSFuture

install_plugin_from_store(plugin_id)#

Install a plugin from the Dataiku plugin store

Parameters:

plugin_id (str) – identifier of the plugin to install

Returns:

A DSSFuture representing the install process

install_plugin_from_git(repository_url, checkout='master', subpath=None)#

Install a plugin from a Git repository. DSS must be setup to allow access to the repository.

Parameters:
  • repository_url (str) – URL of a Git remote

  • checkout (str) – branch/tag/SHA1 to commit. For example “master”

  • subpath (str) – Optional, path within the repository to use as plugin. Should contain a ‘plugin.json’ file

Returns:

A DSSFuture representing the install process

get_plugin(plugin_id)#

Get a handle to interact with a specific plugin

Parameters:

plugin_id (str) – the identifier of the desired plugin

Returns:

A dataikuapi.dss.project.DSSPlugin

sql_query(query, connection=None, database=None, dataset_full_name=None, pre_queries=None, post_queries=None, type='sql', extra_conf=None, script_steps=None, script_input_schema=None, script_output_schema=None, script_report_location=None, read_timestamp_without_timezone_as_string=True, read_date_as_string=False, project_key=None)#

Initiate a SQL, Hive or Impala query and get a handle to retrieve the results of the query.

Internally, the query is run by DSS. The database to run the query on is specified either by passing a connection name, or by passing a database name, or by passing a dataset full name (whose connection is then used to retrieve the database)

Parameters:
  • query (str) – the query to run

  • connection (str) – the connection on which the query should be run (exclusive of database and dataset_full_name)

  • database (str) – the database on which the query should be run (exclusive of connection and dataset_full_name)

  • dataset_full_name (str) – the dataset on the connection of which the query should be run (exclusive of connection and database)

  • pre_queries (list) – (optional) array of queries to run before the query

  • post_queries (list) – (optional) array of queries to run after the query

  • type (str) – the type of query : either ‘sql’, ‘hive’ or ‘impala’ (default: sql)

  • project_key (str) – The project_key on which the query should be run (especially useful for user isolation/impersonation scenario)

Returns:

a handle on the SQL query

Return type:

dataikuapi.dss.sqlquery.DSSSQLQuery

list_users(as_objects=False)#

List all users setup on the DSS instance

Note: this call requires an API key with admin rights

Returns:

A list of users, as a list of dataikuapi.dss.admin.DSSUser if as_objects is True, else as a list of dicts

Return type:

list of dataikuapi.dss.admin.DSSUser or list of dicts

get_user(login)#

Get a handle to interact with a specific user

Parameters:

login (str) – the login of the desired user

Returns:

A dataikuapi.dss.admin.DSSUser user handle

create_user(login, password, display_name='', source_type='LOCAL', groups=None, profile='DATA_SCIENTIST')#

Create a user, and return a handle to interact with it

Note: this call requires an API key with admin rights

Parameters:
  • login (str) – the login of the new user

  • password (str) – the password of the new user

  • display_name (str) – the displayed name for the new user

  • source_type (str) – the type of new user. Admissible values are ‘LOCAL’ or ‘LDAP’

  • groups (list) – the names of the groups the new user belongs to (defaults to [])

  • profile (str) – The profile for the new user, can be one of READER, DATA_ANALYST or DATA_SCIENTIST

Returns:

A dataikuapi.dss.admin.DSSUser user handle

get_own_user()#
list_users_activity(enabled_users_only=False)#

List all users activity

Note: this call requires an API key with admin rights

Returns:

A list of user activity logs, as a list of dataikuapi.dss.admin.DSSUserActivity if as_objects is True, else as a list of dict

Return type:

list of dataikuapi.dss.admin.DSSUserActivity or a list of dict

list_expired_trial_users()#

List users whose trials have expired :return: A list of users

get_authorization_matrix()#

Get the authorization matrix for all enabled users and groups

Note: this call requires an API key with admin rights

Returns:

The authorization matrix

Return type:

A dataikuapi.dss.admin.DSSAuthorizationMatrix authorization matrix handle

start_resync_users_from_supplier(logins)#

Starts a resync of multiple users from an external supplier (LDAP, Azure AD or custom auth)

Parameters:

logins (list) – list of logins to resync

Returns:

a dataikuapi.dss.future.DSSFuture representing the sync process

Return type:

dataikuapi.dss.future.DSSFuture

start_resync_all_users_from_supplier()#

Starts a resync of all users from an external supplier (LDAP, Azure AD or custom auth)

Returns:

a dataikuapi.dss.future.DSSFuture representing the sync process

Return type:

dataikuapi.dss.future.DSSFuture

start_fetch_external_groups(user_source_type)#

Fetch groups from external source

Parameters:

user_source_type – ‘LDAP’, ‘AZURE_AD’ or ‘CUSTOM’

Return type:

dataikuapi.dss.future.DSSFuture

Returns:

a DSSFuture containing a list of group names

start_fetch_external_users(user_source_type, login=None, group_name=None)#
Fetch users from external source filtered by login or group name:
  • if login is provided, will search for a user with an exact match in the external source (e.g. before login remapping)

  • else,
    • if group_name is provided, will search for members of the group in the external source

    • else will search for all users

Parameters:
  • user_source_type – ‘LDAP’, ‘AZURE_AD’ or ‘CUSTOM’

  • login – optional - the login of the user in the external source

  • group_name – optional - the group name of the group in the external source

Return type:

dataikuapi.dss.future.DSSFuture

Returns:

a DSSFuture containing a list of ExternalUser

start_provision_users(user_source_type, users)#

Provision users of given source type

Parameters:
  • user_source_type (string) – ‘LDAP’, ‘AZURE_AD’ or ‘CUSTOM’

  • users (list) – list of user attributes coming form the external source

Return type:

dataikuapi.dss.future.DSSFuture

list_groups()#

List all groups setup on the DSS instance

Note: this call requires an API key with admin rights

Returns:

A list of groups, as an list of dicts

Return type:

list of dicts

get_group(name)#

Get a handle to interact with a specific group

Parameters:

name (str) – the name of the desired group

Returns:

A dataikuapi.dss.admin.DSSGroup group handle

create_group(name, description=None, source_type='LOCAL')#

Create a group, and return a handle to interact with it

Note: this call requires an API key with admin rights

Parameters:
  • name (str) – the name of the new group

  • description (str) – (optional) a description of the new group

  • source_type – the type of the new group. Admissible values are ‘LOCAL’ and ‘LDAP’

Returns:

A dataikuapi.dss.admin.DSSGroup group handle

list_connections(as_type='dictitems')#

List all connections setup on the DSS instance.

Note

This call requires an API key with admin rights

Parameters:

as_type (string) – how to return the connection. Possible values are “dictitems”, “listitems” and “objects”

Returns:

if as_type is dictitems, a dict of connection name to dataikuapi.dss.admin.DSSConnectionListItem. if as_type is listitems, a list of dataikuapi.dss.admin.DSSConnectionListItem. if as_type is objects, a list of dataikuapi.dss.admin.DSSConnection.

Return type:

dict or list

list_connections_names(connection_type)#

List all connections names on the DSS instance.

Parameters:

connection_type (str) – Returns only connections with this type. Use ‘all’ if you don’t want to filter.

Returns:

the list of connections names

Return type:

List[str]

get_connection(name)#

Get a handle to interact with a specific connection

Parameters:

name (str) – the name of the desired connection

Returns:

A dataikuapi.dss.admin.DSSConnection connection handle

create_connection(name, type, params=None, usable_by='ALL', allowed_groups=None)#

Create a connection, and return a handle to interact with it

Note: this call requires an API key with admin rights

Parameters:
  • name – the name of the new connection

  • type – the type of the new connection

  • params (dict) – the parameters of the new connection, as a JSON object (defaults to {})

  • usable_by – the type of access control for the connection. Either ‘ALL’ (=no access control) or ‘ALLOWED’ (=access restricted to users of a list of groups)

  • allowed_groups (list) – when using access control (that is, setting usable_by=’ALLOWED’), the list of names of the groups whose users are allowed to use the new connection (defaults to [])

Returns:

A dataikuapi.dss.admin.DSSConnection connection handle

list_code_envs(as_objects=False)#

List all code envs setup on the DSS instance

Note: this call requires an API key with admin rights

Parameters:

as_objects (boolean) – if True, each returned item will be a dataikuapi.dss.future.DSSCodeEnv

Returns:

a list of code envs. Each code env is a dict containing at least “name”, “type” and “language”

get_code_env(env_lang, env_name)#

Get a handle to interact with a specific code env

Parameters:
  • env_lang – the language (PYTHON or R) of the new code env

  • env_name – the name of the new code env

Returns:

A dataikuapi.dss.admin.DSSCodeEnv code env handle

create_code_env(env_lang, env_name, deployment_mode, params=None)#

Create a code env, and return a handle to interact with it

Note: this call requires an API key with admin rights

Parameters:
  • env_lang – the language (PYTHON or R) of the new code env

  • env_name – the name of the new code env

  • deployment_mode – the type of the new code env

  • params – the parameters of the new code env, as a JSON object

Returns:

A dataikuapi.dss.admin.DSSCodeEnv code env handle

list_code_env_usages()#

List all usages of a code env in the instance

Returns:

a list of objects where the code env is used

create_code_env_from_python_preset(preset_name, allow_update=True, interpreter=None, prefix=None)#
list_clusters()#

List all clusters setup on the DSS instance

Returns:

List clusters (name, type, state)

get_cluster(cluster_id)#

Get a handle to interact with a specific cluster

Args:

name: the name of the desired cluster

Returns:

A dataikuapi.dss.admin.DSSCluster cluster handle

create_cluster(cluster_name, cluster_type='manual', params=None, cluster_architecture='HADOOP')#

Create a cluster, and return a handle to interact with it

Parameters:
  • cluster_name – the name of the new cluster

  • cluster_type – the type of the new cluster

  • params – the parameters of the new cluster, as a JSON object

  • cluster_architecture – the architecture of the new cluster. ‘HADOOP’ or ‘KUBERNETES’

Returns:

A dataikuapi.dss.admin.DSSCluster cluster handle

list_code_studio_templates(as_type='listitems')#

List all code studio templates on the DSS instance

Returns:

List of templates (name, type)

get_code_studio_template(template_id)#

Get a handle to interact with a specific code studio template

Parameters:

template_id (str) – the template id of the desired code studio template

Returns:

A dataikuapi.dss.admin.DSSCodeStudioTemplate code studio template handle

list_global_api_keys(as_type='listitems')#

List all global API keys set up on the DSS instance

Note

This call requires an API key with admin rights

Parameters:

as_type (str) – How to return the global API keys. Possible values are “listitems” and “objects”

Returns:

if as_type=listitems, each key as a dataikuapi.dss.admin.DSSGlobalApiKeyListItem. if as_type=objects, each key is returned as a dataikuapi.dss.admin.DSSGlobalApiKey.

get_global_api_key(key)#

Get a handle to interact with a specific Global API key

Parameters:

key (str) – the secret key of the desired API key

Returns:

A dataikuapi.dss.admin.DSSGlobalApiKey API key handle

create_global_api_key(label=None, description=None, admin=False)#

Create a Global API key, and return a handle to interact with it

Note

This call requires an API key with admin rights

Parameters:
  • label (str) – the label of the new API key

  • description (str) – the description of the new API key

  • admin (str) – has the new API key admin rights (True or False)

Returns:

A dataikuapi.dss.admin.DSSGlobalApiKey API key handle

list_personal_api_keys(as_type='listitems')#

List all your personal API keys.

Parameters:

as_type (str) – How to return the personal API keys. Possible values are “listitems” and “objects”

Returns:

if as_type=listitems, each key as a dataikuapi.dss.admin.DSSPersonalApiKeyListItem. if as_type=objects, each key is returned as a dataikuapi.dss.admin.DSSPersonalApiKey.

get_personal_api_key(id)#

Get a handle to interact with a specific Personal API key.

Parameters:

id (str) – the id of the desired API key

Returns:

A dataikuapi.dss.admin.DSSPersonalApiKey API key handle

create_personal_api_key(label='', description='', as_type='dict')#

Create a Personal API key associated with your user.

Parameters:
  • label (str) – the label of the new API key

  • description (str) – the description of the new API key

  • as_type (str) – How to return the personal API keys. Possible values are “dict” and “object”

Returns:

if as_type=dict, the new personal API key is returned as a dict. if as_type=object, the new personal API key is returned as a dataikuapi.dss.admin.DSSPersonalApiKey.

list_all_personal_api_keys(as_type='listitems')#

List all personal API keys. Only admin can list all the keys.

Parameters:

as_type (str) – How to return the personal API keys. Possible values are “listitems” and “objects”

Returns:

if as_type=listitems, each key as a dataikuapi.dss.admin.DSSPersonalApiKeyListItem. if as_type=objects, each key is returned as a dataikuapi.dss.admin.DSSPersonalApiKey.

create_personal_api_key_for_user(user, label='', description='', as_type='object')#

Create a Personal API key associated on behalf of a user. Only admin can create a key for another user.

Parameters:
  • label (str) – the label of the new API key

  • description (str) – the description of the new API key

  • user (str) – the id of the user to impersonate

  • as_type (str) – How to return the personal API keys. Possible values are “dict” and “object”

Returns:

if as_type=dict, the new personal API key is returned as a dict. if as_type=object, the new personal API key is returned as a dataikuapi.dss.admin.DSSPersonalApiKey.

list_meanings()#

List all user-defined meanings on the DSS instance

Note: this call requires an API key with admin rights

Returns:

A list of meanings. Each meaning is a dict

Return type:

list of dicts

get_meaning(id)#

Get a handle to interact with a specific user-defined meaning

Note: this call requires an API key with admin rights

Parameters:

id (str) – the ID of the desired meaning

Returns:

A dataikuapi.dss.meaning.DSSMeaning meaning handle

create_meaning(id, label, type, description=None, values=None, mappings=None, pattern=None, normalizationMode=None, detectable=False)#

Create a meaning, and return a handle to interact with it

Note: this call requires an API key with admin rights

Parameters:
  • id – the ID of the new meaning

  • type – the type of the new meaning. Admissible values are ‘DECLARATIVE’, ‘VALUES_LIST’, ‘VALUES_MAPPING’ and ‘PATTERN’

  • (optional) (detectable) – the description of the new meaning

  • (optional) – when type is ‘VALUES_LIST’, the list of values, or a list of {‘value’:’the value’, ‘color’:’an optional color’}

  • (optional) – when type is ‘VALUES_MAPPING’, the mapping, as a list of objects with this structure: {‘from’: ‘value_1’, ‘to’: ‘value_a’}

  • (optional) – when type is ‘PATTERN’, the pattern

  • (optional) – when type is ‘VALUES_LIST’, ‘VALUES_MAPPING’ or ‘PATTERN’, the normalization mode to use for value matching. One of ‘EXACT’, ‘LOWERCASE’, or ‘NORMALIZED’ (not available for ‘PATTERN’ type). Defaults to ‘EXACT’.

  • (optional) – whether DSS should consider assigning the meaning to columns set to ‘Auto-detect’. Defaults to False.

Returns:

A dataikuapi.dss.meaning.DSSMeaning meaning handle

list_logs()#

List all available log files on the DSS instance This call requires an API key with admin rights

Returns:

A list of log file names

get_log(name)#

Get the contents of a specific log file This call requires an API key with admin rights

Parameters:

name (str) – the name of the desired log file (obtained with list_logs())

Returns:

The full content of the log file, as a string

log_custom_audit(custom_type, custom_params=None)#

Log a custom entry to the audit trail

Parameters:
  • custom_type (str) – value for customMsgType in audit trail item

  • custom_params (dict) – value for customMsgParams in audit trail item (defaults to {})

get_global_usage_summary(with_per_project=False)#

Gets a summary of the global usage of this DSS instance (number of projects, datasets, …) :returns: a summary object

get_variables()#

Deprecated. Use get_global_variables()

get_global_variables()#

Get the DSS instance’s variables, as a Python dictionary

This call requires an API key with admin rights

Returns:

A dataikuapi.dss.admin.DSSInstanceVariables handle

set_variables(variables)#

Deprecated. Use get_global_variables() and dataikuapi.dss.admin.DSSInstanceVariables.save()

Updates the DSS instance’s variables

This call requires an API key with admin rights

It is not possible to update a single variable, you must set all of them at once. Thus, you should only use a variables parameter that has been obtained using get_variables().

Parameters:

variables (dict) – the new dictionary of all variables of the instance

get_resolved_variables(project_key=None, typed=False)#

Get a dictionary of resolved variables of the project.

Parameters:
  • project_key (str) – the project key, defaults to the current project if any

  • typed (bool) – if True, the variable values will be typed in the returned dict, defaults to False

Returns:

a dictionary with instance and project variables merged

get_general_settings()#

Gets a handle to interact with the general settings.

This call requires an API key with admin rights

Returns:

a dataikuapi.dss.admin.DSSGeneralSettings handle

class PermissionsPropagationPolicy(value)#

An enumeration.

NONE = 'NONE'#
READ_ONLY = 'READ_ONLY'#
ALL = 'ALL'#
create_project_from_bundle_local_archive(archive_path, project_folder=None, permissions_propagation_policy=PermissionsPropagationPolicy.NONE)#

Create a project from a bundle archive. Warning: this method can only be used on an automation node.

Parameters:
  • archive_path (string) – Path on the local machine where the archive is

  • project_folder (A dataikuapi.dss.projectfolder.DSSProjectFolder) – the project folder in which the project will be created or None for root project folder

  • permissions_propagation_policy (A PermissionsPropagationPolicy) – propagate the permissions that were set in the design node to the new project on the automation node (default: False)

create_project_from_bundle_archive(fp, project_folder=None)#

Create a project from a bundle archive (as a file object) Warning: this method can only be used on an automation node.

Parameters:
  • fp (string) – A file-like object pointing to a bundle archive zip

  • project_folder (A dataikuapi.dss.projectfolder.DSSProjectFolder) – the project folder in which the project will be created or None for root project folder

prepare_project_import(f)#

Prepares import of a project archive. Warning: this method can only be used on a design node.

Parameters:

fp (file-like) – the input stream, as a file-like object

Returns:

a TemporaryImportHandle to interact with the prepared import

get_apideployer()#

Gets a handle to work with the API Deployer

Return type:

DSSAPIDeployer

get_projectdeployer()#

Gets a handle to work with the Project Deployer

Return type:

DSSProjectDeployer

get_unified_monitoring()#

Gets a handle to work with Unified Monitoring

Return type:

DSSUnifiedMonitoring

catalog_index_connections(connection_names=None, all_connections=False, indexing_mode='FULL')#

Triggers an indexing of multiple connections in the data catalog

Parameters:
  • connection_names (list) – list of connections to index, ignored if all_connections=True (defaults to [])

  • all_connections (bool) – index all connections (defaults to False)

get_scoring_libs_stream()#

Get the scoring libraries jar required for scoring with model jars that don’t include libraries. You need to close the stream after download. Failure to do so will result in the DSSClient becoming unusable.

Returns:

a jar file, as a stream

Return type:

file-like

get_auth_info(with_secrets=False)#

Returns various information about the user currently authenticated using this instance of the API client.

This method returns a dict that may contain the following keys (may also contain others):

  • authIdentifier: login for a user, id for an API key

  • groups: list of group names (if context is an user)

  • secrets: list of dicts containing user secrets (if context is an user)

Param:

with_secrets boolean: Return user secrets

Returns:

a dict

Return type:

dict

get_auth_info_from_browser_headers(headers_dict, with_secrets=False)#

Returns various information about the DSS user authenticated by the dictionary of HTTP headers provided in headers_dict.

This is generally only used in webapp backends

This method returns a dict that may contain the following keys (may also contain others):

  • authIdentifier: login for a user, id for an API key

  • groups: list of group names (if context is an user)

  • secrets: list of dicts containing user secrets (if context is an user)

Param:

headers_dict dict: Dictionary of HTTP headers

Param:

with_secrets boolean: Return user secrets

Returns:

a dict

Return type:

dict

get_ticket_from_browser_headers(headers_dict)#

Returns a ticket for the DSS user authenticated by the dictionary of HTTP headers provided in headers_dict.

This is only used in webapp backends

This method returns a ticket to use as a X-DKU-APITicket header

Param:

headers_dict dict: Dictionary of HTTP headers

Returns:

a string

Return type:

string

push_base_images()#

Push base images for Kubernetes container-execution and Spark-on-Kubernetes

apply_kubernetes_namespaces_policies()#

Apply Kubernetes namespaces policies defined in the general settings

build_cde_plugins_image()#

Build and Push the image for containerized dss engine (CDE) with plugins :return: A DSSFuture representing the build process

get_instance_info()#

Get global information about the DSS instance

Returns:

a DSSInstanceInfo

perform_instance_sanity_check(exclusion_list=[], wait=True)#

Run an Instance Sanity Check.

This call requires an API key with admin rights.

Parameters:

exclusion_list – a string list of codes to exclude in the sanity check, as returned by get_sanity_check_codes()

Returns:

a dataikuapi.dss.utils.DSSInfoMessages if wait is True, or a dataikuapi.dss.future.DSSFuture handle otherwise

Return type:

dataikuapi.dss.utils.DSSInfoMessages or dataikuapi.dss.future.DSSFuture

get_sanity_check_codes()#

Return the list of codes that can be generated by the sanity check.

This call requires an API key with admin rights.

Return type:

list[str]

get_licensing_status()#

Returns a dictionary with information about licensing status of this DSS instance

Return type:

dict

set_license(license)#

Sets a new licence for DSS

Parameters:

license – license (content of license file)

Returns:

None

get_object_discussions(project_key, object_type, object_id)#

Get a handle to manage discussions on any object

Parameters:
  • project_key (str) – identifier of the project to access

  • object_type (str) – DSS object type

  • object_id (str) – DSS object ID

Returns:

the handle to manage discussions

Return type:

dataikuapi.discussion.DSSObjectDiscussions

get_feature_store()#

Get a handle to interact with the Feature Store.

Returns:

a handle on the feature store

Return type:

dataikuapi.feature_store.DSSFeatureStore

list_workspaces(as_objects=False)#

List the workspaces

Returns:

The list of workspaces.

get_workspace(workspace_key)#

Get a handle to interact with a specific workspace

Parameters:

workspace_key (str) – the workspace key of the desired workspace

Returns:

A dataikuapi.dss.workspace.DSSWorkspace to interact with this workspace

create_workspace(workspace_key, name, permissions=None, description=None, color=None)#

Create a new workspace and return a workspace handle to interact with it

Parameters:
  • workspace_key (str) – the identifier to use for the workspace. Must be globally unique

  • name (str) – the display name for the workspace.

  • permissions ([dataikuapi.dss.workspace.DSSWorkspacePermissionItem]) – Initial permissions for the workspace (can be modified later).

  • description (str) – a description for the workspace.

  • color (str) – The color to use (#RRGGBB format). A random color will be assigned if not specified

Returns:

A dataikuapi.dss.workspace.DSSWorkspace workspace handle to interact with this workspace

list_data_collections(as_type='listitems')#

List the accessible data collections

Parameters:

as_type (str) – How to return the list. Supported values are “listitems”, “objects” and “dict” (defaults to listitems).

Returns:

The list of data collections.

Return type:

a list of dataikuapi.dss.data_collection.DSSDataCollectionListItem if as_type is “listitems”, a list of dataikuapi.dss.data_collection.DSSDataCollection if as_type is “objects”, a list of dict if as_type is “dict”

get_data_collection(id)#

Get a handle to interact with a specific data collection

Parameters:

id (str) – the id of the data collection to fetch

Return type:

dataikuapi.dss.data_collection.DSSDataCollection

create_data_collection(displayName, id=None, tags=None, description=None, color=None, permissions=None)#

Create a new data collection and return a handle to interact with it

Parameters:
  • displayName (str) – the display name for the data collection.

  • id (str) – the identifier to use for the data_collection. Must be 8 alphanumerical characters if set, otherwise a random id will be generated.

  • tags (list of str) – The list of tags to use (defaults to [])

  • description (str) – a description for the data collection

  • color (str) – The color to use (#RRGGBB format). A random color will be assigned if not specified

  • permissions (a list of dict) – Initial permissions for the data collection (can be modified later - current user will always be added as admin).

Returns:

Handle of the newly created Data Collection

Return type:

dataikuapi.dss.data_collection.DSSDataCollection

get_messaging_channel(channel_id)#

Get the messaging channel with the corresponding ID

Parameters:

channel_id – ID of channel as specified Notifications & Integrations UI

Returns:

A messaging channel object, such as DSSMessagingChannel, or a DSSMailMessagingChannel for mail a channel

list_messaging_channels(as_type='listitems', channel_type=None, channel_family=None)#

List all available messaging channels

Parameters:
  • as_type (str) – How to return the list. Supported values are “listitems” and “objects” (defaults to listitems).

  • channel_type (str) – a channel type to filter by, e.g. “smtp”, “aws-ses-mail”, “slack”

  • channel_family (str) – a str to filter for family of channels with a similar interface - “mail” for all channels that send email-like messages

Returns:

A list of messaging channels after the filtering specified, as listitems (DSSMessagingChannelListItem) or objects (DSSMessagingChannel / DSSMailMessagingChannel)

get_data_quality_status()#

Get the status of data-quality monitored projects, including the count of monitored datasets in Ok/Warning/Error/Empty statuses.

Returns:

The dict of data quality monitored project statuses.

Return type:

dict with PROJECT_KEY as key

get_sso_settings()#

Get the Single Sign-On (SSO) settings

Returns:

SSO settings

Return type:

dataikuapi.iam.settings.SSOSettings

get_ldap_settings()#

Get the LDAP settings

Returns:

LDAP settings

Return type:

dataikuapi.iam.settings.LDAPSettings

get_azure_ad_settings()#

Get the Azure Active Directory (aka Microsoft Entra ID) settings

Returns:

Azure AD settings

Return type:

dataikuapi.iam.settings.AzureADSettings

class dataikuapi.dssclient.TemporaryImportHandle(client, import_id)#
execute(settings=None)#

Executes the import with provided settings.

Parameters:

settings (dict) –

Dict of import settings (defaults to {}). The following settings are available:

  • targetProjectKey (string): Key to import under. Defaults to the original project key

  • remapping (dict): Dictionary of connection and code env remapping settings.

    See example of remapping dict:

    "remapping" : {
      "connections": [
        { "source": "src_conn1", "target": "target_conn1" },
        { "source": "src_conn2", "target": "target_conn2" }
      ],
      "codeEnvs" : [
        { "source": "src_codeenv1", "target": "target_codeenv1" },
        { "source": "src_codeenv2", "target": "target_codeenv2" }
      ]
    }
    

@warning: You must check the ‘success’ flag