sempy_labs.sql_database package

Module contents

sempy_labs.sql_database.create_sql_database(name: str, description: str | None = None, workspace: str | UUID | None = None)

Creates a SQL database.

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

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

Parameters:
  • name (str) – Name of the SQL database.

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

  • 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.sql_database.delete_sql_database(sql_database: str | UUID, workspace: str | UUID | None = None)

Deletes a SQL Database.

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

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

Parameters:
  • sql_database (str | uuid.UUID) – Name of the SQL database.

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

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

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

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

Return type:

pandas.DataFrame

sempy_labs.sql_database.get_sql_database_tables(sql_database: str | UUID, workspace: str | UUID | None = None) DataFrame

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

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

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

Return type:

pandas.DataFrame

sempy_labs.sql_database.list_restorable_deleted_databases(workspace: str | UUID | None = None) DataFrame

Lists restorable deleted SQL databases in the Fabric workspace.

This is a wrapper function for the following API: Items - List Restorable Deleted SQL Databases.

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 a list of restorable deleted SQL databases in the Fabric workspace.

Return type:

pandas.DataFrame

sempy_labs.sql_database.list_sql_databases(workspace: str | UUID | None = None) DataFrame

Lists all SQL databases in the Fabric workspace.

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

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 a list of SQL databases in the Fabric workspace.

Return type:

pandas.DataFrame

sempy_labs.sql_database.revalidate_cmk(sql_database: str | UUID, workspace: str | UUID | None = None)

Revalidates the Customer Managed Key (CMK) for the specified SQL database.

This is a wrapper function for the following API: Items - Revalidate CMK.

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

Parameters:
  • sql_database (str | uuid.UUID) – Name of the SQL database.

  • 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.sql_database.start_mirroring(sql_database: str | UUID, workspace: str | UUID | None = None)

Starts data mirroring for the specified SQL Database.

This is a wrapper function for the following API: Mirroring - Start Mirroring.

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

Parameters:
  • sql_database (str | uuid.UUID) – Name or ID of the SQL Database.

  • 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.sql_database.stop_mirroring(sql_database: str | UUID, workspace: str | UUID | None = None)

Stops data mirroring for the specified SQL Database.

This is a wrapper function for the following API: Mirroring - Stop Mirroring.

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

Parameters:
  • sql_database (str | uuid.UUID) – Name or ID of the SQL Database.

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