Project libraries#

class dataikuapi.dss.projectlibrary.DSSLibrary(client, project_key)#

A handle to manage the library of a project It saves locally a copy of taxonomy to help navigate in the library All modifications done through this object and related library items are done locally and on remote.

Note

Taxonomy modifications done outside this library are not reflected locally. You should reload the library in this case.

list(folder_path='/')#

Lists the contents in the given library folder or on the root if no folder is given.

Parameters:

folder_path (str) – the folder path (optional). If no path is given, it is defaulted to the root path.

Returns:

the list of contents in the library folder

Return type:

list of dataikuapi.dss.projectlibrary.DSSLibraryItem

get_file(path)#

Retrieves a file in the library

Parameters:

path (str) – the file path

Returns:

the file in the given path

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryFile

get_folder(path)#

Retrieves a folder in the library

Parameters:

path (str) – the folder path

Returns:

the folder in the given path

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryFolder

add_file(file_name)#

Create a file in the library root folder

Parameters:

file_name (str) – the file name

Returns:

the new file

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryFile

add_folder(folder_name)#

Create a folder in the library root folder

Parameters:

folder_name (str) – the folder name

Returns:

the new folder

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryFolder

class dataikuapi.dss.projectlibrary.DSSLibraryItem(client, project_key, name, parent, children)#

A handle to manage a library item

property path#
is_root()#
delete()#

Deletes this item from library

rename(new_name)#

Rename the folder

Parameters:

new_name (str) – the new name of the item

move_to(destination_folder)#

Move a library item to another folder

Parameters:

destination_folder (dataikuapi.dss.projectlibrary.DSSLibraryFolder) – the folder where we want to move the current item

class dataikuapi.dss.projectlibrary.DSSLibraryFolder(client, project_key, name, parent, children)#

A handle to manage a library folder

Warning

Do not call directly, use dataikuapi.dss.projectlibrary.DSSLibrary.get_folder

get_child(name)#

Retrieve the sub item by its name

Parameters:

name (str) – the name of the sub item

Returns:

the sub item

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryItem

add_file(file_name)#

Create a new file in the library folder

Parameters:

file_name (str) – the file name

Returns:

the new file

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryFile

add_folder(folder_name)#

Create a folder in the library

Parameters:

folder_name (str) – the name of the folder to add

Returns:

the new folder

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryFolder

list()#

Gets the contents of this folder sorted by name

Returns:

a sorted list of items

Return type:

list of dataikuapi.dss.projectlibrary.DSSLibraryItem

get_file(path)#

Retrieves a file in the library

Parameters:

path (str) – the file path

Returns:

the file in the given path

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryFile

get_folder(path)#

Retrieves a folder in the library

Parameters:

path (str) – the folder path

Returns:

the folder in the given path

Return type:

dataikuapi.dss.projectlibrary.DSSLibraryFolder

class dataikuapi.dss.projectlibrary.DSSLibraryFile(client, project_key, name, parent)#

A handle to manage a library file

Warning

Do not call directly, use dataikuapi.dss.projectlibrary.DSSLibrary.get_file()

read(as_type='str')#

Get the file contents from DSS

Parameters:

as_type (str) – specify whether you want to read the file in text mode (as_type=’str’) or in binary mode (as_type=’bytes’). Defaults to text mode.

Returns:

the contents of the file as a string

write(data)#

Updates the contents of the file with the given data