Skip to main content
Version: devel

dlt.destinations.impl.lance.lance_client

LanceClient Objects

class LanceClient(JobClientBase, WithStateSync, WithSqlClient)

View source on GitHub

create_dataset_namespace

@raise_destination_error
def create_dataset_namespace() -> None

View source on GitHub

Creates child namespace for dataset in root namespace.

drop_dataset_namespace

@raise_destination_error
def drop_dataset_namespace() -> None

View source on GitHub

Drops dataset namespace after removing all its tables.

dataset_namespace_exists

@raise_destination_error
def dataset_namespace_exists() -> bool

View source on GitHub

Returns True if child namespace for dataset exists in root namespace.

create_table

@raise_destination_error
def create_table(table_name: str, schema: pa.Schema) -> None

View source on GitHub

Creates empty lance dataset from provided PyArrow schema.

drop_table

@raise_destination_error
def drop_table(table_name: str) -> None

View source on GitHub

Drops table from lance dataset namespace.

make_table_id

def make_table_id(table_name: str) -> List[str]

View source on GitHub

Returns namespace table_id for given table name.

drop_tables

def drop_tables(*tables: str) -> None

View source on GitHub

Drops tables from lance dataset namespace.

drop_storage

def drop_storage() -> None

View source on GitHub

Drops dataset namespace and all its tables.

truncate_table

def truncate_table(table_name: str) -> None

View source on GitHub

Truncates table by deleting all rows in active branch.

open_lance_dataset

@raise_destination_error
def open_lance_dataset(table_name: str,
branch_name: Optional[str] = None,
version_number: Optional[int] = None) -> LanceDataset

View source on GitHub

Returns lance dataset for given table name.

Arguments:

  • table_name str - Name of table to open dataset for.
  • branch_name Optional[str] - Branch to check out. Uses main branch if None.
  • version_number Optional[int] - Dataset version to check out. Uses latest if None.

Returns:

  • LanceDataset - The dataset checked out at the specified branch and version.

open_lancedb_table

def open_lancedb_table(table_name: str) -> LanceTable

View source on GitHub

Returns LanceDB table for given table name.

This provides access to LanceDB-specific features like vector search.

write_records

def write_records(
records: Union[pa.RecordBatchReader, List[Dict[str, Any]]],
table_name: str,
*,
branch_name: Optional[str] = None,
write_disposition: Optional[TWriteDisposition] = "append",
merge_key: Optional[str] = None,
when_not_matched_by_source_delete_expr: Optional[str] = None) -> None

View source on GitHub

Inserts records into Lance dataset with automatic embedding computation.

make_arrow_table_schema

def make_arrow_table_schema(table_name: str) -> pa.Schema

View source on GitHub

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

get_stored_state

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

View source on GitHub

Retrieves the latest completed state for a pipeline.

get_stored_schema

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.