@lancedb/lancedb β’ Docs
@lancedb/lancedb / connect
Function: connect()
connect(uri, options, session, headerProvider)
Connect to a LanceDB instance at the given URI.
Accepted formats:
/path/to/database- local databases3://bucket/path/to/databaseorgs://bucket/path/to/database- database on cloud storagedb://host:port- remote database (LanceDB cloud)
Parameters
-
uri:
stringThe uri of the database. If the database uri starts withdb://then it connects to a remote database. -
options?:
Partial<ConnectionOptions> The options to use when connecting to the database -
session?:
Session -
headerProvider?:
HeaderProvider| () =>Record<string,string> | () =>Promise<Record<string,string>>
Returns
Promise<Connection>
See
ConnectionOptions for more details on the URI format.
Examples
Using with a header provider for per-request authentication:
const provider = new StaticHeaderProvider({
"X-API-Key": "my-key"
});
const conn = await connectWithHeaderProvider(
"db://host:port",
options,
provider
);
connect(options)
Connect to a LanceDB instance at the given URI.
Accepted formats:
/path/to/database- local databases3://bucket/path/to/databaseorgs://bucket/path/to/database- database on cloud storagedb://host:port- remote database (LanceDB cloud)
Parameters
- options:
Partial<ConnectionOptions> &objectThe options to use when connecting to the database
Returns
Promise<Connection>
See
ConnectionOptions for more details on the URI format.