sempy_labs.variable_library package

Module contents

sempy_labs.variable_library.delete_variable_library(variable_library: str | UUID, workspace: str | UUID | None = None)

Deletes a variable library.

This is a wrapper function for the following API: `Items - Delete Variable Library https://learn.microsoft.com/rest/api/fabric/variablelibrary/items/delete-variable-library>`_.

Parameters:
  • navariable_libraryme (str | uuid.UUID) – Name or ID of the variable library.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

sempy_labs.variable_library.get_variable_library(variable_library: str | UUID, workspace: str | UUID | None = None) DataFrame

Returns properties of the specified variable library.

This is a wrapper function for the following API: Items - Get Variable Library.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • variable_library (str | uuid.UUID) – Name or ID of the variable library.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Returns:

A pandas dataframe showing the properties of the variable library.

Return type:

pandas.DataFrame

sempy_labs.variable_library.get_variable_library_definition(variable_library: str | UUID, workspace: str | UUID | None = None, decode: bool = True, return_dataframe: bool = False) dict | DataFrame

Gets the definition of a variable library.

This is a wrapper function for the following API: Items - Get Variable Library Definition.

Service Principal Authentication is supported (see here for examples).

Parameters:

workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Returns:

A dictionary showing the definition or a pandas dataframe showing the definition.

Return type:

dict | pandas.DataFrame

sempy_labs.variable_library.get_variable_value(variable_name: str, variable_library: str | UUID, workspace: str | UUID | None = None, value_set: str | None = None) Any

Gets the value of a single variable in a variable library.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • variable_name (str) – Name of the variable.

  • variable_library (str | uuid.UUID) – Name or ID of the variable library.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

  • value_set (str, default=None) – The name of the value set to use for variable overrides. If None, the active value set of the variable library will be used.

Returns:

The value of the variable.

Return type:

Any

sempy_labs.variable_library.get_variable_values(variable_names: List[str], variable_library: str | UUID, workspace: str | UUID | None = None, value_set: str | None = None) dict

Gets the values of multiple variables from a variable library with a single call to list_variables.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • variable_names (List[str]) – A list of variable names to retrieve.

  • variable_library (str | uuid.UUID) – Name or ID of the variable library.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

  • value_set (str, default=None) – The name of the value set to use for variable overrides. If None, the active value set of the variable library will be used.

Returns:

Dictionary mapping variable names to their corresponding values.

Return type:

dict

sempy_labs.variable_library.list_variable_libraries(workspace: str | UUID | None = None) DataFrame

Shows the variable libraries within a workspace.

This is a wrapper function for the following API: Items - List Variable Libraries.

Service Principal Authentication is supported (see here for examples).

Parameters:

workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Returns:

A pandas dataframe showing the variable libraries within a workspace.

Return type:

pandas.DataFrame

sempy_labs.variable_library.list_variables(variable_library: str | UUID, workspace: str | UUID | None = None) DataFrame

Lists the variables in a variable library.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • variable_library (str | uuid.UUID) – Name or ID of the variable library.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Returns:

A pandas dataframe showing the variables within a variable library.

Return type:

pandas.DataFrame