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) <noreply@anthropic.com>
This commit is contained in:
Wyatt Alt
2026-06-16 05:51:33 -07:00
committed by Jack Ye
parent 3d92106394
commit 6af3088b91
2 changed files with 10 additions and 6 deletions

View File

@@ -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.

View File

@@ -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):