From 6af3088b91d873426d3fae2dfa41dd6f586423de Mon Sep 17 00:00:00 2001 From: Wyatt Alt Date: Tue, 16 Jun 2026 05:51:33 -0700 Subject: [PATCH] client: make refresh_materialized_view private (reach it via the handle) Refresh is a submit-a-job verb, so its only public surface should be MaterializedView.refresh() / AsyncMaterializedView.refresh() (which return a job handle). Rename the connection methods to _refresh_materialized_view and have the handles call that, so the raw by-name refresh is no longer advertised on the connection. The pyo3 native binding is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- python/python/lancedb/db.py | 12 ++++++++---- python/python/lancedb/udf.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/python/python/lancedb/db.py b/python/python/lancedb/db.py index a46851e9c..e0fae6c01 100644 --- a/python/python/lancedb/db.py +++ b/python/python/lancedb/db.py @@ -705,7 +705,7 @@ class DBConnection(EnforceOverrides): return JobHandle(self, job_id) - def refresh_materialized_view( + def _refresh_materialized_view( self, name: str, *, @@ -714,7 +714,10 @@ class DBConnection(EnforceOverrides): num_workers: Optional[int] = None, max_workers: Optional[int] = None, ) -> str: - """Refresh a materialized view; returns the refresh job id. + """Internal: submit a materialized-view refresh, return the job id. + The public surface is ``MaterializedView.refresh()`` (which returns a + `JobHandle`); this stays private so refresh is only reached through the + handle. ``full=True`` forces a full rebuild (recompute and replace every row) instead of the default incremental refresh. @@ -2094,7 +2097,7 @@ class AsyncConnection(object): return AsyncJobHandle(self, job_id) - async def refresh_materialized_view( + async def _refresh_materialized_view( self, name: str, *, @@ -2103,7 +2106,8 @@ class AsyncConnection(object): num_workers: Optional[int] = None, max_workers: Optional[int] = None, ) -> str: - """Refresh a materialized view; returns the refresh job id. + """Internal: submit a refresh, return the job id. The public surface is + ``AsyncMaterializedView.refresh()`` (returns an `AsyncJobHandle`). ``full=True`` forces a full rebuild (recompute and replace every row) instead of the default incremental refresh. diff --git a/python/python/lancedb/udf.py b/python/python/lancedb/udf.py index 2da5b97d6..968aa0561 100644 --- a/python/python/lancedb/udf.py +++ b/python/python/lancedb/udf.py @@ -520,7 +520,7 @@ class MaterializedView: instead of the default incremental refresh. A full rebuild preserves the view's indexes -- they are reindexed by the distributed indexer. """ - job_id = self.conn.refresh_materialized_view(self.name, full=full) + job_id = self.conn._refresh_materialized_view(self.name, full=full) return JobHandle(self.conn, job_id) def explain_refresh(self, full: bool = False): @@ -648,7 +648,7 @@ class AsyncMaterializedView: ``full=True`` forces a full rebuild instead of an incremental refresh (indexes are preserved and reindexed by the distributed indexer). """ - job_id = await self.conn.refresh_materialized_view(self.name, full=full) + job_id = await self.conn._refresh_materialized_view(self.name, full=full) return AsyncJobHandle(self.conn, job_id) async def explain_refresh(self, full: bool = False):