User Defined Functions

analyze.udf.add_label(project_id, udf_id, label)

Sets a label on a udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • label (str) – The label unique name

Returns

list of dicts with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

list

analyze.udf.add_path(project_id, udf_id, path)

Adds a table reference path in the hierarchy

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • path (str) – Object rollup path using unix style forward slashes

Returns

None

analyze.udf.add_paths(project_id, additions)

Adds multiple udf reference paths in the hierarchy

Parameters
  • project_id (str) – Unique project identifier

  • additions (list) – List of moves, containing: udf_id (str): Unique udf identifier to_path (str): New path

Returns

None

analyze.udf.copy(project_id, udf_id, rollup_id, after_position)

Copies a udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • rollup_id (str) – Unique rollup identifier

  • after_position (int) – Position within the object rollup the object should be placed after

Returns

result dict with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

dict

analyze.udf.copy_directory(project_id, from_path, to_path)

Copies a folder and all paths in the hierarchy but does not duplicate referenced objects

Parameters
  • project_id (str) – Unique project identifier

  • from_path (str) – Original directory path

  • to_path (str) – Destination directory path

Returns

None

analyze.udf.create(project_id, path, name, id=None, memo=None, extension='py', view_manager=False, view_explorer=False, file_path=None)

Creates a udf

Parameters
  • project_id (str) – Unique project identifier

  • path (str) – Path to place udf in hierarchy

  • name (str) – The object name

  • id (str) – Canonical ID for UDF. Must be lowercase letters, numbers, -, or _

  • memo (str) – The object description

  • extension (str) – The udf code syntax type

  • view_manager (bool) – UDF is visible to Manager roles if True

  • view_explorer (bool) – UDF is visible to Explorer roles if True

  • file_path (str) – Path to UDF code in project repo. Defaults to <name>.<extension>

Returns

result dict with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

dict

analyze.udf.create_directory(project_id, path)

Creates a folder in the table hierarchy

Parameters
  • project_id (str) – Unique project identifier

  • path (str) – Path to directory

Returns

None

analyze.udf.delete(project_id, udf_id)

Deletes a udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

Returns

None

analyze.udf.delete_directory(project_id, path)

Deletes a folder and removes path from all objects in that directory

Parameters
  • project_id (str) – Unique project identifier

  • path (str) – Path to directory

Returns

None

analyze.udf.flashback_backup(project_id, udf_id)

Schedules a backup of the udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

Returns

None

analyze.udf.flashback_hold(project_id, udf_id, version_id)

Puts a hold on a version to prevent lifecycle cleanup after retention period

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • version_id (str) – Version of the udf to hold

Returns

None

analyze.udf.flashback_release(project_id, udf_id, version_id)

Releases a hold on a version to allow lifecycle cleanup after retention period

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • version_id (str) – Version of the udf to release

Returns

None

analyze.udf.flashback_restore(project_id, udf_id, version_id, target_udf_id)

Restores udf data to the target udf specified

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • version_id (str) – Version of the udf to restore

  • target_udf_id (str) – Target udf UUID

Returns

None

analyze.udf.flashback_restore_project(project_id)

Schedules a restore of all udfs in the project to their latest version stored

Parameters

project_id (str) – Unique project identifier

Returns

None

analyze.udf.flashback_udfs(project_id)

Provides list of udfs stored in flashback

Parameters

project_id (str) – Unique project identifier

Returns

List of udfs

Return type

list

analyze.udf.flashback_versions(project_id, udf_id)

Provides list of versions of the udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

Returns

List of udf versions

Return type

list

analyze.udf.get_code(project_id, udf_id)

Gets the code for the UDF

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

Returns

User Defined Function code

Return type

str

analyze.udf.ids_from_path(project_id, path)

Provides the cannonical id for the from a provided path

Parameters
  • project_id (str) – Unique project identifier

  • path (str) – Object rollup path using unix style forward slashes

Returns

Unique udf ID on the specified path

Return type

str

analyze.udf.labels(project_id, udf_id)

Provides a list of labels for the udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

Returns

list of labels associated with UDF

Return type

list

analyze.udf.lookup_by_full_path(project_id, path)

Returns ID for path provided

Parameters
  • project_id (str) – Unique project identifier

  • path (str) – Object rollup path using unix style forward slashes

Returns

UDF unique identifier

Return type

str

analyze.udf.lookup_by_name(project_id, name)

Returns ID for path provided

Parameters
  • project_id (str) – Unique project identifier

  • name (str) – Unique UDF name

Returns

UDF unique identifier

Return type

str

analyze.udf.move(project_id, udf_id, rollup_id, after_position)

Deletes a workflow udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • rollup_id (str) – Unique rollup identifier

  • after_position (int) – Position within the object rollup the object should be placed after

Returns

None

analyze.udf.move_directory(project_id, from_path, to_path)

Updates a folder name in the hierarchy

Parameters
  • project_id (str) – Unique project identifier

  • from_path (str) – Original directory path

  • to_path (str) – Destination directory path

Returns

None

analyze.udf.move_path(project_id, udf_id, from_path, to_path)

Moves a table reference path in the hierarchy

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • from_path (str) – Original path

  • to_path (str) – Destination path

Returns

None

analyze.udf.move_paths(project_id, moves)

Moves a udf reference path in the hierarchy

Parameters
  • project_id (str) – Unique project identifier

  • moves (list) – List of move dicts with the following keys: - udf_id (str): Unique udf identifier - from_path (str): Original path - to_path (str): Destination path

Returns

None

analyze.udf.paths(project_id, path=None)

Provides a list of paths for all udfs in the project

Parameters
  • project_id (str) – Unique project identifier

  • path (str) – Initial path to search

Returns

List of Dicts consisting of:
  • path (str): UDF leaf or branch path

  • type (str): leaf or branch to indicate the path type

  • id (str): For leaf type paths, the object the path points to

Return type

list

analyze.udf.paths_from_id(project_id, udf_id)

Provides a list of paths associated with the cannonical id

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

Returns

List of paths associated with a UDF ID

Return type

list

analyze.udf.remove_label(project_id, udf_id, label)

Removes a label on a udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • label (str) – The label unique name

Returns

list of dicts with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

list

analyze.udf.remove_path(project_id, udf_id, path)

Removes a table reference path in the hierarchy

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • path (str) – Object rollup path using unix style forward slashes

Returns

None

analyze.udf.search_by_label(project_id, text, criteria='contains', sort=None, keys=None)

Returns list of udfs that match the search criteria

Parameters
  • project_id (str) – Unique project identifier

  • text (str) – The search text to locate

  • criteria (str) – The search criteria (contains, exact, startswith, or endswith)

  • sort (list) – List of sort tuples using syntax (key, reverse). e.g. [(‘name’, False)]

  • keys (list) – List of keys to return. Defaults to all.

Returns

list of dicts with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

list

analyze.udf.search_by_name(project_id, text, criteria='contains', path='/', sort=None, keys=None)

Returns list of udfs that match the search criteria

Parameters
  • project_id (str) – Unique project identifier

  • text (str) – The search text to locate

  • criteria (str) – The search criteria (contains, exact, startswith, or endswith)

  • path (str) – Path to search below for matches

  • sort (list) – List of sort tuples using syntax (key, reverse). e.g. [(‘name’, False)]

  • keys (list) – List of keys to return. Defaults to all.

Returns

list of dicts with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

list

analyze.udf.set_code(project_id, udf_id, code, message='')

Sets the code for the UDF

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • code (str) – User Defined Function code

  • message (str) – Code commit message

Returns

None

analyze.udf.shift_down(project_id, udf_ids, path)

Move the node below following node within the same generation If bottom within parent, it moves to the next parent below at the same generation as it’s parent (if there is one)

Parameters
  • project_id (str) – Unique project identifier

  • udf_ids (list) – List of Unique udf identifier

  • path (str) – Current hierarchy path

Returns

New path or None if cannot be moved

Return type

str

analyze.udf.shift_left(project_id, udf_ids, path)

Move the node one generation up (if possible)

Parameters
  • project_id (str) – Unique project identifier

  • udf_ids (list) – List of Unique udf identifier

  • path (str) – Current hierarchy path

Returns

New path or None if cannot be moved

Return type

str

analyze.udf.shift_right(project_id, step_ids, path)

Move the node one generation down, looking upwards in the hierarchy for a suitable parent (if there is one)

Parameters
  • project_id (str) – Unique project identifier

  • udf_ids (list) – List of Unique udf identifier

  • path (str) – Current hierarchy path

Returns:udf_ids

str: New path or None if cannot be moved

analyze.udf.shift_up(project_id, udf_ids, path)

Move the node above prior node within the same generation If top within parent, it moves to the next parent above at the same generation as it’s parent (if there is one)

Parameters
  • project_id (str) – Unique project identifier

  • udf_ids (list) – List of Unique udf identifier

  • path (str) – Current hierarchy path

Returns

New path or None if cannot be moved

Return type

str

analyze.udf.udf(project_id, udf_id, keys=None)

Provides detailed udf information

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

  • keys (list, optional) – List of keys to return. Defaults to all.

Returns

result dict with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

dict

analyze.udf.udfs(project_id, id_filter=None, sort=None, keys=None, member_details=False)

Provides list of udfs in specified project

Parameters
  • project_id (str) – Unique project identifier

  • id_filter (list, optional) – List or tuple of object unique identifiers to which to limit the results

  • sort (list, optional) – List of sort tuples using syntax (key, reverse). e.g. [(‘name’, False)]

  • keys (list, optional) – List of keys to return. Defaults to all.

  • member_details (bool, optional) – If True then returns member info relating to updated_by

Returns

result tuple of dicts with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

If member_details is set to True, the dict will also contain:
  • updated_by_full_name (str): The User Name of the user that last updated the project

  • updated_by_user_id (int): The id of the user that last updated the project

  • updated_by_gravatar_hash (str): Unique hash to pull gravatar for the user.

Return type

list

analyze.udf.udfs_from_label(project_id, label, sort=None, keys=None)

Provides list of udfs for based on set of labels. Uses AND condition.

Parameters
  • project_id (str) – Unique project identifier

  • label (str) – label name

  • sort (list) – List of sort tuples using syntax (key, reverse). e.g. [(‘name’, False)]

  • keys (list) – List of keys to return. Defaults to all.

Returns

list of dicts with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

list

analyze.udf.udfs_from_path(project_id, path, sort=None, keys=None)

Provides list of udfs based on a path fragment. Path fragment can be to parent level.

Parameters
  • project_id (str) – Unique project identifier

  • path (str) – Object rollup path using unix style forward slashes

  • sort (list, optional) – List of sort tuples using syntax (key, reverse). e.g. [(‘name’, False)]

  • keys (list, optional) – List of keys to return. Defaults to all.

Returns

list of dicts with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

list

analyze.udf.update(project_id, udf_id, **kwargs)

Updates a udf

Parameters
  • project_id (str) – Unique project identifier

  • udf_id (str) – Unique udf identifier

Kwargs:
  • name (str): The object name

  • memo (str): The object description

  • extension (str): The udf code syntax type

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • file_path (str): Path to UDF code in project repo

Returns

result dict with the following properties
  • project_id (str): Unique project identifier

  • id (str): Unique udf identifier

  • name (str): UDF name

  • memo (str): UDF description

  • paths (list): List of paths assigned to udf

  • file_path (str): Path to UDF code in project repo

  • labels (list): List of labels assigned to udf

  • view_manager (bool): UDF is visible to Manager roles if True

  • view_explorer (bool): UDF is visible to Explorer roles if True

  • extension (str): UDF code syntax type

  • update_time (str): Date and time data was updated as ISO 8601 compliant time

  • updated_by (int): User ID of last updater

Return type

dict

analyze.udf.view_explorer(project_id, udf_ids, allowed=True)

Sets View Explorer flag

Parameters
  • project_id (str) – Unique project identifier

  • udf_ids (str) – Unique udf identifier or list of identifiers

  • allowed (bool) – Indicate whether Explorer role can view item

Returns

None

analyze.udf.view_manager(project_id, udf_ids, allowed=True)

Sets View Manager flag

Parameters
  • project_id (str) – Unique project identifier

  • udf_ids (str) – Unique udf identifier or list of identifiers

  • allowed (bool) – Indicate whether Manager role can view item

Returns

None