Skip to main content
Version: devel

dlt.destinations.impl.lancedb.lancedb_client

ON_BAD_VECTORS

Text that cannot be embedded lands with a null vector, as in the lance destination.

LanceDBClient Objects

class LanceDBClient(JobClientBase, WithStateSync, WithSqlClient)

View source on GitHub

model_func

The embedder callback used for each chunk, None when embeddings are not configured.

make_namespace_path

@staticmethod
def make_namespace_path() -> List[str]

View source on GitHub

Returns the root namespace, which holds every table of the dataset.

list_table_names

@lancedb_error
def list_table_names() -> List[str]

View source on GitHub

Lists all tables in the dataset namespace.

list_namespace_names

@lancedb_error
def list_namespace_names() -> List[str]

View source on GitHub

Lists all namespaces of the database of the dataset.

create_dataset

@lancedb_error
def create_dataset() -> None

View source on GitHub

Creates the dataset by creating its sentinel namespace, which creates the database.

drop_dataset

@lancedb_error
def drop_dataset() -> None

View source on GitHub

Drops the tables of the dataset and the sentinel that records it as created.

dataset_exists

def dataset_exists() -> bool

View source on GitHub

Returns True if the sentinel records the dataset as created.

create_table

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

View source on GitHub

Creates an empty table in the dataset namespace from the provided PyArrow schema.

Arguments:

  • table_name - The name of the table to create.
  • schema - The table schema to create.
  • mode str - "create" raises if the table already exists, "overwrite" replaces it.

Returns:

  • lancedb.table.Table - The created table.

open_table

@lancedb_error
def open_table(table_name: str) -> "lancedb.table.Table"

View source on GitHub

Opens a table of the dataset namespace at its latest version.

drop_tables

@lancedb_error
def drop_tables(*tables: str, delete_schema: bool = True) -> None

View source on GitHub

Drops tables of the dataset namespace and optionally deletes the stored schema.

Arguments:

  • tables - The names of the tables to drop.
  • delete_schema - If True, also delete all versions of the current schema from storage.

truncate_table

@lancedb_error
def truncate_table(table_name: str) -> None

View source on GitHub

Truncates the table by deleting all its rows, preserving its schema, tags and history.

drop_storage

def drop_storage() -> None

View source on GitHub

Drops the tables of the dataset and the sentinel that records it as created.

write_records

@lancedb_error
def write_records(
records: DATA,
table_name: str,
*,
write_disposition: Optional[TWriteDisposition] = "append",
merge_key: Optional[str] = None,
merge_strategy: Optional[TLoaderMergeStrategy] = None,
when_not_matched_by_source_delete_expr: Optional[str] = None) -> int

View source on GitHub

Inserts records into a table of the dataset namespace.

when_not_matched_by_source_delete_expr bounds which rows a merge may delete, and without it a merge deletes nothing.

Returns:

  • int - Version the write created, which a caller must use instead of reading it back.

list_owned_table_names

def list_owned_table_names() -> List[str]

View source on GitHub

Returns the destination tables of the dataset that materialize a schema table.

add_null_columns_to_table

@lancedb_error
def add_null_columns_to_table(table_name: str,
columns: List[TColumnSchema]) -> None

View source on GitHub

Extends the table schema with nullable columns filled with null values.

make_table_arrow_schema

def make_table_arrow_schema(table_name: str) -> TArrowSchema

View source on GitHub

Creates a PyArrow schema for a table, including embedding metadata if configured.

get_stored_state

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

View source on GitHub

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 on GitHub

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.