class lance.LanceFragment(pyarrow._dataset.Fragment)

Public members

LanceFragment(dataset: LanceDataset, fragment_id: int | None, ...)

Initialize self. See help(type(self)) for accurate signature.

__repr__()

Return repr(self).

__reduce__()

Fragment.__reduce_cython__(self)

static create_from_file(filename: str, ...) FragmentMetadata

Create a fragment from the given datafile uri.

static create(dataset_uri: str | Path, ...) FragmentMetadata

Create a FragmentMetadata from the given data.

property fragment_id
count_rows(Expression filter=None, ...)

Count rows matching the scanner filter.

property num_deletions : int

Return the number of deleted rows in this fragment.

property physical_rows : int

Return the number of rows originally in this fragment.

property physical_schema : Schema

Return the physical schema of this Fragment. This schema can be different from the dataset read schema.

property partition_expression : Schema

An Expression which evaluates to true for all data viewed by this Fragment.

head(int num_rows, columns=None, Expression filter=None, ...)

Load the first N rows of the fragment.

scanner(*, ...) LanceScanner

See Dataset::scanner for details

take(indices, columns=None, Expression filter=None, ...)

Select rows of data by index.

to_batches(Schema schema=None, columns=None, ...)

Read the fragment as materialized record batches.

to_table(Schema schema=None, columns=None, ...)

Convert this Fragment into a Table.

merge(data_obj, ...) tuple[FragmentMetadata, LanceSchema]

Merge another dataset into this fragment.

merge_columns(...) tuple[FragmentMetadata, LanceSchema]

Add columns to this Fragment.

delete(predicate: str) FragmentMetadata | None

Delete rows from this Fragment.

property schema : Schema

Return the schema of this fragment.

data_files()

Return the data files of this fragment.

deletion_file()

Return the deletion file, if any

property metadata : FragmentMetadata

Return the metadata of this fragment.

classmethod LanceFragment(*args, **kwargs)

Create and return a new object. See help(type) for accurate signature.