From ec82e363170b78fb9854458b72ef8a7746011414 Mon Sep 17 00:00:00 2001 From: Zhaocun Sun Date: Sat, 23 May 2026 01:51:09 +0800 Subject: [PATCH] docs(python): document in-memory connections (#3434) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem Issue #2247 notes that the Python docs do not show how to use LanceDB's in-memory backend via `connect("memory://")`. ## Solution Add `memory://` examples to the sync and async `connect` docstrings, and call out that in-memory databases are intended for tests/temporary data and are not persisted. ## Validation - `python3 -m py_compile python/python/lancedb/__init__.py` - `git diff --check` ## Confidence 82/100 — docs-only update, directly tied to the documented missing `memory://` usage. It changes API documentation only and was syntax/diff validated. Closes #2247. --- python/python/lancedb/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python/python/lancedb/__init__.py b/python/python/lancedb/__init__.py index efeed258f..9ddecc6cf 100644 --- a/python/python/lancedb/__init__.py +++ b/python/python/lancedb/__init__.py @@ -147,6 +147,13 @@ def connect( >>> db = lancedb.connect("s3://my-bucket/lancedb", ... storage_options={"aws_access_key_id": "***"}) + For tests and temporary data, use an in-memory database: + + >>> db = lancedb.connect("memory://") + + In-memory databases are not persisted. Tables are dropped when the last + connection or table handle referencing them is closed. + Connect to LanceDB cloud: >>> db = lancedb.connect("db://my_database", api_key="ldb_...", @@ -378,6 +385,8 @@ async def connect_async( ... db = await lancedb.connect_async("s3://my-bucket/lancedb", ... storage_options={ ... "aws_access_key_id": "***"}) + ... # For tests and temporary data, use an in-memory database + ... db = await lancedb.connect_async("memory://") ... # Connect to LanceDB cloud ... db = await lancedb.connect_async("db://my_database", api_key="ldb_...", ... client_config={