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)
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]
Returns the root namespace, which holds every table of the dataset.
list_table_names
@lancedb_error
def list_table_names() -> List[str]
Lists all tables in the dataset namespace.
list_namespace_names
@lancedb_error
def list_namespace_names() -> List[str]
Lists all namespaces of the database of the dataset.
create_dataset
@lancedb_error
def create_dataset() -> None
Creates the dataset by creating its sentinel namespace, which creates the database.
drop_dataset
@lancedb_error
def drop_dataset() -> None
Drops the tables of the dataset and the sentinel that records it as created.
dataset_exists
def dataset_exists() -> bool
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"
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.modestr -"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"
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
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
Truncates the table by deleting all its rows, preserving its schema, tags and history.
drop_storage
def drop_storage() -> None
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
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]
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
Extends the table schema with nullable columns filled with null values.
make_table_arrow_schema
def make_table_arrow_schema(table_name: str) -> TArrowSchema
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]
Retrieves the latest completed state for a pipeline.
get_stored_schema
@lancedb_error
def get_stored_schema(schema_name: str = None) -> Optional[StorageSchemaInfo]
Retrieves newest schema from destination storage.