- lance.LanceDataset.delete(predicate: str | Expression)
Delete rows from the dataset.
This marks rows as deleted, but does not physically remove them from the files. This keeps the existing indexes still valid.
- Parameters:
- predicate : str or pa.compute.Expression¶
The predicate to use to select rows to delete. May either be a SQL string or a pyarrow Expression.
Examples
>>> import lance >>> import pyarrow as pa >>> table = pa.table({"a": [1, 2, 3], "b": ["a", "b", "c"]}) >>> dataset = lance.write_dataset(table, "example") >>> dataset.delete("a = 1 or b in ('a', 'b')") >>> dataset.to_table() pyarrow.Table a: int64 b: string ---- a: [[3]] b: [["c"]]