Skip to main content

Function: createLakebasePoolManager()

Function: createLakebasePoolManager()

function createLakebasePoolManager(baseConfig?: Partial<LakebasePoolConfig>): LakebasePoolManager;

Create a pool manager that maintains per-key Lakebase connection pools.

Each pool is created via createLakebasePool with the base config merged with per-pool overrides (e.g. a user's workspaceClient and user).

A periodic cleanup removes empty Pool objects (where all connections have been closed by pg's built-in idleTimeoutMillis) from the internal Map.

Parameters

ParameterType
baseConfig?Partial<LakebasePoolConfig>

Returns

LakebasePoolManager

Example

const poolManager = createLakebasePoolManager();

// In a route handler:
const userPool = poolManager.getPool(userName, {
  workspaceClient: new WorkspaceClient({ token: userToken, host, authType: "pat" }),
  user: userName,
});
const result = await userPool.query("SELECT * FROM products");

Databricks Developer Hub

Ready to ship your next agentic app in minutes?

Read docs