sempy_labs.warehouse package

Module contents

sempy_labs.warehouse.create_restore_point(warehouse: str | UUID, name: str, description: str | None = None, workspace: str | UUID | None = None)

Creates a restore point in a warehouse.

This is a wrapper function for the following API: Restore Points - Create Restore Point.

Parameters:
  • warehouse (str | uuid.UUID) – The Fabric warehouse name or ID.

  • name (str) – The name of the restore point.

  • description (str, default=None) – The description of the restore point.

  • 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.warehouse.create_warehouse(warehouse: str, description: str | None = None, case_insensitive_collation: bool = False, workspace: str | UUID | None = None) UUID

Creates a Fabric warehouse.

This is a wrapper function for the following API: Items - Create Warehouse.

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

Parameters:
  • warehouse (str) – Name of the warehouse.

  • description (str, default=None) – A description of the warehouse.

  • case_insensitive_collation (bool, default=False) – If True, creates the warehouse with case-insensitive collation.

  • 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:

The ID of the created warehouse.

Return type:

uuid.UUID

sempy_labs.warehouse.delete_restore_point(warehouse: str | UUID, restore_point: str | UUID, workspace: str | UUID | None = None)

Deletes a restore point from a warehouse.

This is a wrapper function for the following API: Restore Points - Delete Restore Point.

Parameters:
  • warehouse (str | uuid.UUID) – The Fabric warehouse name or ID.

  • restore_point (str | uuid.UUID) – The restore point name or ID.

  • 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.warehouse.delete_warehouse(name: str | UUID, workspace: str | UUID | None = None)

Deletes a Fabric warehouse.

This is a wrapper function for the following API: Items - Delete Warehouse.

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

Parameters:
  • name (str | uuid.UUID) – Name or ID of the warehouse.

  • 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.warehouse.get_warehouse_columns(warehouse: str | UUID, workspace: str | UUID | None = None) DataFrame

Shows a list of the columns in each table within the Fabric warehouse. This function is based on INFORMATION_SCHEMA.COLUMNS.

Parameters:
  • warehouse (str | uuid.UUID) – Name or ID of the Fabric warehouse.

  • 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 a list of the columns in each table within the Fabric warehouse.

Return type:

pandas.DataFrame

sempy_labs.warehouse.get_warehouse_tables(warehouse: str | UUID, workspace: str | UUID | None = None) DataFrame

Shows a list of the tables in the Fabric warehouse. This function is based on INFORMATION_SCHEMA.TABLES.

Parameters:
  • warehouse (str | uuid.UUID) – Name or ID of the Fabric warehouse.

  • 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 a list of the tables in the Fabric warehouse.

Return type:

pandas.DataFrame

sempy_labs.warehouse.list_restore_points(warehouse: str | UUID, workspace: str | UUID | None = None) DataFrame

Returns all restore points for a warehouse.

This is a wrapper function for the following API: Restore Points - List Restore Points.

Parameters:
  • warehouse (str | uuid.UUID) – The Fabric warehouse name or ID.

  • 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 all restore points for a warehouse.

Return type:

pandas.DataFrame

sempy_labs.warehouse.list_warehouses(workspace: str | UUID | None = None) DataFrame

Shows the warehouses within a workspace.

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

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 warehouses within a workspace.

Return type:

pandas.DataFrame

sempy_labs.warehouse.restore_to_restore_point(warehouse: str | UUID, restore_point: str | UUID, workspace: str | UUID | None = None)

Restores a warehouse in-place to the restore point specified.

This is a wrapper function for the following API: Restore Points - Restore To Restore Point.

Parameters:
  • warehouse (str | uuid.UUID) – The Fabric warehouse name or ID.

  • restore_point (str | uuid.UUID) – The restore point name or ID.

  • 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.warehouse.update_restore_point(warehouse: str | UUID, restore_point: str | UUID, name: str | None = None, description: str | None = None, workspace: str | UUID | None = None)

Updates a restore point in a warehouse.

This is a wrapper function for the following API: Restore Points - Update Restore Point.

Parameters:
  • warehouse (str | uuid.UUID) – The Fabric warehouse name or ID.

  • restore_point (str | uuid.UUID) – The restore point name or ID.

  • name (str, default=None) – The new name of the restore point.

  • description (str, default=None) – The new description of the restore point.

  • 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.