fix(python): keep open_table override signatures compatible with branch

This commit is contained in:
Brendan Clement
2026-06-02 23:20:47 -07:00
parent 38454969cd
commit d96ae4b986
2 changed files with 9 additions and 1 deletions

View File

@@ -544,6 +544,7 @@ class LanceNamespaceDBConnection(DBConnection):
namespace_path: Optional[List[str]] = None,
storage_options: Optional[Dict[str, str]] = None,
index_cache_size: Optional[int] = None,
branch: Optional[str] = None,
) -> Table:
if namespace_path is None:
namespace_path = []
@@ -562,7 +563,7 @@ class LanceNamespaceDBConnection(DBConnection):
raise TableNotFoundError(f"Table not found: {'$'.join(table_id)}")
raise
return LanceTable(
tbl = LanceTable(
self,
name,
namespace_path=namespace_path,
@@ -570,6 +571,9 @@ class LanceNamespaceDBConnection(DBConnection):
pushdown_operations=self._namespace_client_pushdown_operations,
_async=async_table,
)
if branch is not None:
return tbl.branches.checkout(branch)
return tbl
@override
def drop_table(self, name: str, namespace_path: Optional[List[str]] = None):

View File

@@ -383,6 +383,7 @@ class RemoteDBConnection(DBConnection):
namespace_path: Optional[List[str]] = None,
storage_options: Optional[Dict[str, str]] = None,
index_cache_size: Optional[int] = None,
branch: Optional[str] = None,
) -> Table:
"""Open a Lance Table in the database.
@@ -400,6 +401,9 @@ class RemoteDBConnection(DBConnection):
"""
from .table import RemoteTable
if branch is not None:
raise NotImplementedError("branching is not yet supported on remote tables")
if namespace_path is None:
namespace_path = []
if index_cache_size is not None: