Managed folders in Python API

This class lets you interact with managed folders in Python recipes and notebooks. See Managed folders for more information.

class dataiku.core.managed_folder.Folder(lookup, project_key=None)

This is a handle to interact with a managed folder.

Note: this class is also available as dataiku.Folder

clear()

Removes all files from the folder

clear_partition(partition)

Removes all files from the folder’s partition

clear_path(path)

Removes a file or directory from the folder

file_path(filename)

Gets the filesystem path for a given file within the folder

Parameters:filename (str) – Name of the file within the folder
get_last_metric_values(partition='')

Get the set of last values of the metrics on this folder, as a dataiku.ComputedMetrics object

get_metric_history(metric_lookup, partition='')

Get the set of all values a given metric took on this folder :param metric_lookup: metric name or unique identifier :param partition: optionally, the partition for which the values are to be fetched

get_partition_folder(partition)

Gets the filesystem path of the directory corresponding to the partition (if the partitioning is directory-based)

get_path()

Gets the filesystem path of the folder

is_partitioning_directory_based()

Whether the partitioning of the folder is based on sub-directories

list_partitions()

Gets the partitions in the folder

list_paths_in_partition(partition='')

Gets the filesystem paths of the folder for the given partition (or for the entire folder)

read_json(filename)

Reads a JSON file within the folder and returns its parsed content

Parameters:filename (str) – Name of the file within the folder
save_external_check_values(values_dict)

Save checks on this folder. The checks are saved with the type “external”

Parameters:values_dict – the values to save, as a dict. The keys of the dict are used as check names
save_external_metric_values(values_dict)

Save metrics on this folder. The metrics are saved with the type “external”

Parameters:values_dict – the values to save, as a dict. The keys of the dict are used as metric names
write_json(filename, obj)

Writes an object (or array) as JSON to a file within the folder

Parameters:
  • filename (str) – Name of the target file within the folder
  • obj (str) – JSON-serializable object to write (generally dict or list)