Skip to main content
Version: 0.5.4

destinations.impl.lancedb.lancedb_client

upload_batch

def upload_batch(records: List[DictStrAny],
*,
db_client: DBConnection,
table_name: str,
write_disposition: TWriteDisposition,
id_field_name: Optional[str] = None) -> None

[view_source]

Inserts records into a LanceDB table with automatic embedding computation.

Arguments:

  • records - The data to be inserted as payload.
  • db_client - The LanceDB client connection.
  • table_name - The name of the table to insert into.
  • id_field_name - The name of the ID field for update/merge operations.
  • write_disposition - The write disposition - one of 'skip', 'append', 'replace', 'merge'.

Raises:

  • ValueError - If the write disposition is unsupported, or id_field_name is not provided for update/merge operations.

LanceDBClient Objects

class LanceDBClient(JobClientBase, WithStateSync)

[view_source]

LanceDB destination handler.

create_table

@lancedb_error
def create_table(table_name: str,
schema: TArrowSchema,
mode: str = "create") -> Table

[view_source]

Create a LanceDB Table from the provided LanceModel or PyArrow schema.

Arguments:

  • schema - The table schema to create.
  • table_name - The name of the table to create. mode (): The mode to use when creating the table. Can be either "create" or "overwrite". By default, if the table already exists, an exception is raised. If you want to overwrite the table, use mode="overwrite".

delete_table

def delete_table(table_name: str) -> None

[view_source]

Delete a LanceDB table.

Arguments:

  • table_name - The name of the table to delete.

query_table

def query_table(
table_name: str,
query: Union[List[Any], NDArray, Array, ChunkedArray, str, Tuple[Any],
None] = None
) -> LanceQueryBuilder

[view_source]

Query a LanceDB table.

Arguments:

  • table_name - The name of the table to query.
  • query - The targeted vector to search for.

Returns:

A LanceDB query builder.

drop_storage

@lancedb_error
def drop_storage() -> None

[view_source]

Drop the dataset from the LanceDB instance.

Deletes all tables in the dataset and all data, as well as sentinel table associated with them.

If the dataset name was not provided, it deletes all the tables in the current schema.

add_table_fields

@lancedb_error
def add_table_fields(table_name: str,
field_schemas: List[TArrowField]) -> Optional[Table]

[view_source]

Add multiple fields to the LanceDB table at once.

Arguments:

  • table_name - The name of the table to create the fields on.
  • field_schemas - The list of fields to create.

get_stored_state

@lancedb_error
def get_stored_state(pipeline_name: str) -> Optional[StateInfo]

[view_source]

Retrieves the latest completed state for a pipeline.

get_stored_schema

@lancedb_error
def get_stored_schema() -> Optional[StorageSchemaInfo]

[view_source]

Retrieves newest schema from destination storage.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.