lance-format / lance-format/lance
How do I relocate / rename / replace a registered base path on an existing dataset?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.1k
- Forks
- 852
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 272
Description
Summary
When a dataset is created with initial_bases=[DatasetBasePath(...)], there doesn't appear to be a supported way to later change that base path — for example, to point the same logical base at a new S3 location after data has been moved. LanceDataset.add_bases() only adds new bases (and rejects duplicate names or paths), and initial_bases is documented as CREATE-only. I'd like to know what the intended workflow is.
Environment
pylance4.0.1- Python 3.12
- Linux
Reproducer
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "pylance>=0.38",
# "pyarrow",
# ]
# ///
import lance
import pyarrow as pa
from lance import DatasetBasePath
S3_BASE = "s3://my-bucket/my-prefix"
VIDEO_URI = f"{S3_BASE}/abc/video.mp4"
table = pa.table({
"id": pa.array([1], type=pa.int64()),
"video": lance.blob_array([VIDEO_URI]),
})
lance.write_dataset(
table,
"./videos.lance",
data_storage_version="2.2",
initial_bases=[DatasetBasePath(path=S3_BASE, name="my_base")],
allow_external_blob_outside_bases=False,
)
After the dataset exists, the registered bases look like:
{1: DatasetBasePath(id=1, name=Some("my_base"), path=s3://my-bucket/my-prefix, is_dataset_root=false)}
What I want to do
Relocate the external blobs to a new bucket/prefix (e.g., s3://my-new-bucket/my-new-prefix) and update the dataset so that the base previously named my_base now resolves to the new path —
1. Re-add with the same name or same path
ds._ds.add_bases(
[DatasetBasePath(path="s3://my-new-bucket/my-new-prefix", name="my_base")],
None,
)
Fails with:
ValueError: Invalid user input: Conflict detected: Base path with name 'Some("my_base")'
or path 's3://my-new-bucket/my-new-prefix' already exists.
Same error when passing id=1 explicitly to match the existing base.
2. Add a new base under a different name
ds._ds.add_bases(
[DatasetBasePath(path="s3://my-new-bucket/my-new-prefix", name="my_base_v2")],
None,
)
This succeeds, but now the manifest carries both bases, and the original one is still present with no way to remove it. I couldn't find a remove_bases / update_bases / rename_base API on LanceDataset or on the inner _Dataset.
3. Re-run write_dataset with new initial_bases
Per the docstring:
initial_bases: Only used in CREATE mode. Cannot be specified in APPEND or OVERWRITE modes.
So this only works after deleting the dataset directory and recreating from scratch.
Questions
- Is there a supported way to rename, replace, or remove an existing
DatasetBasePathon a dataset, or to repoint one at a new path? - If not, is the expected workflow to
add_bases(...)under a new name and then rewrite the blob columns so their URIs fall under the new base, leaving the old base as a dangling manifest entry forever? - Is there a recommended pattern for the "I physically moved the files in S3, now update the dataset" scenario?
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the DatasetBasePath and add_bases entry points, then compare them with write_dataset's CREATE-only initial_bases behavior. Determine the supported workflow for renaming, replacing, or removing a registered base after external blobs move; done should be a documented, tested answer or an agreed API design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- data-engineering
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100