Share via


FabricLakehouseClient Class

This class is used to connect to Lakehouse resources. You can use this class to connect to both SQL and Files endpoints.

A User Data Function with a parameter of this type must be decorated with connection (see the example under Remarks).

Don't worry about using the constructor to create an instance of this class. Fabric will automatically create it for you (as long as you follow the steps within Remarks).

Constructor

FabricLakehouseClient(alias_name: str, endpoints: Dict[str, Dict[str, str]])

Parameters

Name Description
alias_name
Required
str

The alias for the data source being connected to, configured in the portal.

endpoints
Required

The different endpoints for the data source.

Remarks

To use this class and have Fabric make the proper connections to your Lakehouse, you must:

  • Add a data connection in the Connections tab of your User Data Functions on the portal.
  • Add a parameter to your User Data Function with the type 'FabricLakehouseClient'.
  • Add the decorator connection to your User Data Function that references the parameter and the alias of the data connection you made.

Methods

connectToFiles

Connects to the Files endpoint of the Lakehouse. Call this within your function before attempting to query the endpoint.

connectToFilesAsync

Connects to the Files endpoint of the Lakehouse. Call this within your function before attempting to query the endpoint. Returns a client that can be used in async functions.

connectToSql

Connects to the SQL endpoint of the Lakehouse. Call this within your function before attempting to query the endpoint.

connectToFiles

Connects to the Files endpoint of the Lakehouse. Call this within your function before attempting to query the endpoint.

connectToFiles() -> DataLakeDirectoryClient

connectToFilesAsync

Connects to the Files endpoint of the Lakehouse. Call this within your function before attempting to query the endpoint. Returns a client that can be used in async functions.

connectToFilesAsync() -> DataLakeDirectoryClient

connectToSql

Connects to the SQL endpoint of the Lakehouse. Call this within your function before attempting to query the endpoint.

connectToSql() -> Connection