From a49cf47a3d467d319ac5afb4280d0f9a860a68e5 Mon Sep 17 00:00:00 2001 From: Ryan Green Date: Thu, 25 Jun 2026 09:05:49 -0230 Subject: [PATCH] handle async client --- python/python/lancedb/namespace.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/python/python/lancedb/namespace.py b/python/python/lancedb/namespace.py index 8d6fa61a6..23d4f7885 100644 --- a/python/python/lancedb/namespace.py +++ b/python/python/lancedb/namespace.py @@ -897,6 +897,8 @@ class AsyncLanceNamespaceDBConnection: storage_options: Optional[Dict[str, str]] = None, session: Optional[Session] = None, namespace_client_pushdown_operations: Optional[List[str]] = None, + namespace_client_impl: Optional[str] = None, + namespace_client_properties: Optional[Dict[str, str]] = None, ): """ Initialize an async namespace-based LanceDB connection. @@ -922,6 +924,12 @@ class AsyncLanceNamespaceDBConnection: namespace.create_table() instead of using declare_table + local write. Default is None (no pushdown, all operations run locally). + namespace_client_impl : Optional[str] + The namespace implementation name used to create this connection. + Required (with ``namespace_client_properties``) for the Rust client to + be built natively and install the read-freshness provider. + namespace_client_properties : Optional[Dict[str, str]] + The namespace properties used to create this connection. """ self._namespace_client = namespace_client self.read_consistency_interval = read_consistency_interval @@ -930,6 +938,14 @@ class AsyncLanceNamespaceDBConnection: self._namespace_client_pushdown_operations = set( namespace_client_pushdown_operations or [] ) + self._namespace_client_impl = namespace_client_impl + self._namespace_client_properties = namespace_client_properties + # See LanceNamespaceDBConnection: when built natively the Rust table runs + # QueryTable pushdown through the read-freshness provider, so defer to it + # rather than the urllib3 client (which omits x-lancedb-min-timestamp). + self._route_pushdown_to_rust = _builds_namespace_natively( + namespace_client_impl, namespace_client_properties + ) self._inner = AsyncConnection( _connect_namespace_client( namespace_client, @@ -943,8 +959,8 @@ class AsyncLanceNamespaceDBConnection: namespace_client_pushdown_operations=( list(self._namespace_client_pushdown_operations) ), - namespace_client_impl=None, - namespace_client_properties=None, + namespace_client_impl=namespace_client_impl, + namespace_client_properties=namespace_client_properties, ) ) @@ -1014,6 +1030,7 @@ class AsyncLanceNamespaceDBConnection: namespace_path=namespace_path, namespace_client=self._namespace_client, pushdown_operations=self._namespace_client_pushdown_operations, + route_pushdown_to_rust=self._route_pushdown_to_rust, ) async def open_table( @@ -1051,6 +1068,7 @@ class AsyncLanceNamespaceDBConnection: namespace_path=namespace_path, namespace_client=self._namespace_client, pushdown_operations=self._namespace_client_pushdown_operations, + route_pushdown_to_rust=self._route_pushdown_to_rust, ) async def drop_table(self, name: str, namespace_path: Optional[List[str]] = None): @@ -1409,4 +1427,6 @@ def connect_namespace_async( storage_options=storage_options, session=session, namespace_client_pushdown_operations=namespace_client_pushdown_operations, + namespace_client_impl=namespace_client_impl, + namespace_client_properties=namespace_client_properties, )