CatalogConnection.list_databases should return an iterator so that users don't have to manually re-implement pagination. For those who do want more control over pagination, add num_page_results and page_token to the Iterator object, and also allow the iterator object to be created at a specific page token.
1.7 KiB
@lancedb/lancedb • Docs
@lancedb/lancedb / Catalog
Class: Catalog
A remote catalog manages databases through the server's root namespace.
Accessors
uri
get uri(): string
The root namespace endpoint.
Returns
string
Methods
connectDatabase()
connectDatabase(name): Promise<Connection>
Connect to an existing database by its logical name.
Parameters
- name:
string
Returns
Promise<Connection>
createDatabase()
createDatabase(name, options): Promise<Connection>
Create a database, or open an existing database when existOk is true.
Parameters
-
name:
string -
options =
{} -
options.existOk?:
boolean
Returns
Promise<Connection>
dropDatabase()
dropDatabase(name, options): Promise<void>
Drop an empty database. The server rejects nonempty databases.
Parameters
-
name:
string -
options =
{} -
options.ignoreMissing?:
boolean
Returns
Promise<void>
listDatabases()
listDatabases(options): DatabaseNames
Iterate lazily over all database names using for await...of.
pageToken resumes from a saved token; omitted starts at the beginning.
pageLimit limits each REST response, not the total; omitted uses the server default.
Request errors are raised during iteration and terminate the iterator.
Parameters
-
options =
{} -
options.pageLimit?:
number -
options.pageToken?:
string
Returns
Example
for await (const name of catalog.listDatabases({ pageLimit: 20 })) {
console.log(name);
}