Skip to main content
Version: 1.4.0 (latest)

destinations.impl.lancedb.lancedb_client

write_records

def write_records(records: DATA,
*,
db_client: DBConnection,
table_name: str,
write_disposition: Optional[TWriteDisposition] = "append",
merge_key: Optional[str] = None,
remove_orphans: Optional[bool] = False,
filter_condition: 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.
  • merge_key - Keys for update/merge operations.
  • write_disposition - The write disposition - one of 'skip', 'append', 'replace', 'merge'.
  • remove_orphans bool - Whether to remove orphans after insertion or not (only merge disposition).
  • filter_condition str - If None, then all such rows will be deleted. Otherwise, the condition will be used as an SQL filter to limit what rows are deleted.

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.

model_func

The embedder callback used for each chunk.

create_table

@lancedb_error
def create_table(table_name: str,
schema: TArrowSchema,
mode: str = "create") -> "lancedb.table.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 str - 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 wasn't provided, it deletes all the tables in the current schema.

extend_lancedb_table_schema

@lancedb_error
def extend_lancedb_table_schema(table_name: str,
field_schemas: List[pa.Field]) -> None

[view_source]

Extend LanceDB table schema with empty columns.

Arguments:

  • table_name - The name of the table to create the fields on.
  • field_schemas - The list of PyArrow Fields to create in the target LanceDB table.

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(schema_name: str = None) -> 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.