FabricTools v0.33.0 Public Preview

Start-FabricLakehouseTableMaintenance

Initiates a table maintenance job for a specified Lakehouse in a Fabric workspace.

Syntax

Start-FabricLakehouseTableMaintenance [-WorkspaceId] <guid> [-LakehouseId] <guid>
 [[-JobType] <string>] [[-SchemaName] <string>] [[-TableName] <string>] [[-IsVOrder] <bool>]
 [[-ColumnsZOrderBy] <array>] [[-retentionPeriod] <string>] [[-waitForCompletion] <bool>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

Description

This function sends a POST request to the Fabric API to start a table maintenance job for a specified Lakehouse. It allows for optional parameters such as schema name, table name, and Z-ordering columns. The function also handles asynchronous operations and can wait for completion if specified.

Examples

Example 1

Initiates a table maintenance job for the specified Lakehouse and waits for its completion.

Start-FabricLakehouseTableMaintenance -WorkspaceId "12345" -LakehouseId "67890" -JobType "TableMaintenance" -SchemaName "dbo" -TableName "MyTable" -IsVOrder $true -ColumnsZOrderBy @("Column1", "Column2") -retentionPeriod "7:00:00" -waitForCompletion $true

Example 2

Initiates a table maintenance job for the specified Lakehouse without waiting for its completion.

Start-FabricLakehouseTableMaintenance -WorkspaceId "12345" -LakehouseId "67890" -JobType "TableMaintenance" -SchemaName "dbo" -TableName "MyTable" -IsVOrder $false -ColumnsZOrderBy @("Column1", "Column2") -retentionPeriod "7:00:00"

Parameters

NameTypeReq.Pos.PipelineDescription
-LakehouseId guid ✓Required 1 –

The unique identifier of the Lakehouse for which the table maintenance job is to be initiated. This parameter is mandatory.

-WorkspaceId guid ✓Required 0 –

The unique identifier of the workspace where the Lakehouse resides. This parameter is mandatory.

-ColumnsZOrderBy array 6 –

An array of columns to be used for Z-ordering. This parameter is optional.

-Confirmalias: cf switch Named –

Prompts you for confirmation before running the cmdlet.

-IsVOrder bool 5 –

A boolean flag indicating whether to apply V-ordering. This parameter is optional.

Default: False
-JobType string 2 –

The type of job to be initiated. Default is "TableMaintenance". This parameter is optional.

Default: TableMaintenance
-retentionPeriod string 7 –

The retention period for the table maintenance job. This parameter is optional.

-SchemaName string 3 –

The name of the schema in the Lakehouse. This parameter is optional.

-TableName string 4 –

The name of the table in the Lakehouse. This parameter is optional.

-waitForCompletion bool 8 –

A boolean flag indicating whether to wait for the job to complete. Default is false. This parameter is optional.

Default: False
-WhatIfalias: wi switch Named –

Runs the command in a mode that only reports what would happen without performing the actions.

This cmdlet also supports the common parameters, such as -Verbose and -ErrorAction. See about_CommonParameters.

Notes

  • Requires $FabricConfig global configuration, including BaseUrl and FabricHeaders.
  • Calls Confirm-TokenState to ensure token validity before making the API request.
  • This function handles asynchronous operations and retrieves operation results if required.
  • The function uses the Write-Message function for logging and debugging purposes.
  • The function uses the Get-FabricLakehouse function to retrieve Lakehouse details.
  • The function uses the Get-FabricLongRunningOperation function to check the status of long-running operations.
  • The function uses the Invoke-RestMethod cmdlet to make API requests.

Author: Tiago Balabuch, Kamil Nowinski