lakehouse Package
Functions
create_lakehouse
Create a lakehouse in the specified workspace.
create_lakehouse(display_name: str, description: str | None = None, workspace: str | UUID | None = None, folder: str | PathLike | UUID | None = None, enable_schema: bool = False, lro_config: LroConfig | None = None, credential: TokenCredential | None = None, **kwargs) -> str
Parameters
| Name | Description |
|---|---|
|
display_name
Required
|
The display name of the lakehouse. |
|
description
|
The optional description of the lakehouse. Default value: None
|
|
workspace
|
The Fabric workspace name or UUID object containing the workspace 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. Default value: None
|
|
folder
|
The Fabric folder path, folder ID, or UUID object containing the folder ID to create the lakehouse. Defaults to None which creates the lakehouse under the workspace root. Experimental: This parameter is experimental and may change in future versions. Default value: None
|
|
enable_schema
|
If True, the notebook will be created with schema enabled. Default value: False
|
|
lro_config
|
<xref:sempy.fabric.lakehouse.LroConfig>
Options to control LRO polling behavior. See LroConfig for available keys and defaults. Default value: None
|
|
credential
|
<xref:sempy.fabric.lakehouse.TokenCredential>
The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used. Default value: None
|
|
**kwargs
Required
|
Deprecated keyword arguments. Use |
Returns
| Type | Description |
|---|---|
|
The id of lakehouse. |
delete_lakehouse
Delete a lakehouse in the specified workspace.
delete_lakehouse(lakehouse: str | UUID | None = None, workspace: str | UUID | None = None, credential: TokenCredential | None = None) -> None
Parameters
| Name | Description |
|---|---|
|
lakehouse
|
The Fabric lakehouse name or UUID object containing the lakehouse ID. Defaults to None which resolves to the lakehouse of the attached lakehouse or if no lakehouse attached, raises an error. Default value: None
|
|
workspace
|
The Fabric workspace name or UUID object containing the workspace ID. If None, defaults to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook. Default value: None
|
|
credential
|
<xref:sempy.fabric.lakehouse.TokenCredential>
The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used. Default value: None
|
get_lakehouse_id
Return lakehouse id of the lakehouse that is connected to the workspace.
get_lakehouse_id() -> str
Returns
| Type | Description |
|---|---|
|
Lakehouse id guid. |
list_lakehouse_tables
List all tables in a lakehouse and their properties.
This is a wrapper function for Tables - List Tables.
-[ Notes ]-
When extended=True, this function attempts to retrieve capacity SKU information to
calculate guardrail columns. If the capacity cannot be accessed (e.g., the user lacks
permissions), a warning will be issued and guardrail columns will be set to None.
list_lakehouse_tables(lakehouse: str | UUID | None = None, workspace: str | UUID | None = None, extended: bool = False, count_rows: bool = False, extend_method: Literal['spark', 'python'] | None = None, credential: TokenCredential | None = None) -> DataFrame
Parameters
| Name | Description |
|---|---|
|
lakehouse
|
The Fabric lakehouse name or UUID object containing the lakehouse ID. Defaults to None which resolves to the lakehouse of the attached lakehouse or if no lakehouse attached, raises an error. Default value: None
|
|
workspace
|
The Fabric workspace name or UUID object containing the workspace ID. If None, defaults to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook. Default value: None
|
|
extended
|
Obtains additional columns relevant to the size of each table. Default value: False
|
|
count_rows
|
Obtains a row count for each lakehouse table. Default value: False
|
|
extend_method
|
The method to use for extending table statistics when extended=True.
Default value: None
|
|
credential
|
<xref:sempy.fabric.lakehouse.TokenCredential>
The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used. Default value: None
|
Returns
| Type | Description |
|---|---|
|
DataFrame with one row per table containing the table properties. |
Exceptions
| Type | Description |
|---|---|
|
If |
optimize_lakehouse_tables
Run the OPTIMIZE function over the specified lakehouse tables.
This compacts small files into larger ones to improve read performance.
optimize_lakehouse_tables(tables: str | List[str] | None = None, lakehouse: str | UUID | None = None, workspace: str | UUID | None = None, method: Literal['spark', 'python'] | None = None, credential: TokenCredential | None = None) -> None
Parameters
| Name | Description |
|---|---|
|
tables
|
The table(s) to optimize. If no tables are specified, all Delta tables in the lakehouse will be optimized. Default value: None
|
|
lakehouse
|
The Fabric lakehouse name or ID. Defaults to None which resolves to the lakehouse attached to the notebook. Default value: None
|
|
workspace
|
The Fabric workspace name or ID used by the lakehouse. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook. Default value: None
|
|
method
|
The method to use for optimizing Delta tables:
Default value: None
|
|
credential
|
<xref:sempy.fabric.lakehouse.TokenCredential>
The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used. Default value: None
|
resolve_lakehouse_id
Resolve the ID of a lakehouse in the specified workspace.
resolve_lakehouse_id(lakehouse: str | UUID | None = None, workspace: str | UUID | None = None, credential: TokenCredential | None = None) -> str
Parameters
| Name | Description |
|---|---|
|
lakehouse
|
The Fabric lakehouse name or UUID object containing the lakehouse ID. Defaults to None which resolves to the lakehouse of the attached lakehouse or if no lakehouse attached, raises an error. Default value: None
|
|
workspace
|
The Fabric workspace name or UUID object containing the workspace ID. If None, defaults to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook. Default value: None
|
|
credential
|
<xref:sempy.fabric.lakehouse.TokenCredential>
The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The resolved lakehouse ID. |
resolve_lakehouse_name
Resolve the name of a lakehouse in the specified workspace.
resolve_lakehouse_name(lakehouse: str | UUID | None = None, workspace: str | UUID | None = None, credential: TokenCredential | None = None) -> str
Parameters
| Name | Description |
|---|---|
|
lakehouse
|
The Fabric lakehouse name or UUID object containing the lakehouse ID. Defaults to None which resolves to the lakehouse of the attached lakehouse or if no lakehouse attached, raises an error. Default value: None
|
|
workspace
|
The Fabric workspace name or UUID object containing the workspace ID. If None, defaults to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook. Default value: None
|
|
credential
|
<xref:sempy.fabric.lakehouse.TokenCredential>
The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The resolved lakehouse name. |
vacuum_lakehouse_tables
Run the VACUUM function over the specified lakehouse tables.
vacuum_lakehouse_tables(tables: str | List[str] | None = None, lakehouse: str | UUID | None = None, workspace: str | UUID | None = None, retention_hours: float | None = None, method: Literal['spark', 'python'] | None = None, credential: TokenCredential | None = None)
Parameters
| Name | Description |
|---|---|
|
tables
|
The table(s) to vacuum. If no tables are specified, all tables in the lakehouse will be vacuumed. Default value: None
|
|
lakehouse
|
The Fabric lakehouse name or ID. Defaults to None which resolves to the lakehouse attached to the notebook. Default value: None
|
|
workspace
|
The Fabric workspace name or ID used by the lakehouse. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook. Default value: None
|
|
retention_hours
|
The number of hours to retain historical versions of Delta table files. Files older than this retention period will be deleted during the vacuum operation. If not specified, the default retention period configured for the Delta table will be used. The default retention period is 168 hours (7 days) unless manually configured via table properties. Default value: None
|
|
method
|
The method to use for vacuuming Delta tables:
Default value: None
|
|
credential
|
<xref:sempy.fabric.lakehouse.TokenCredential>
The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used. Default value: None
|