Repository navigation
feat: add asynchronous remote SQL queries - #4070
Conversation
0631762 to
e3fa767
Compare
There was a problem hiding this comment.
The SQL patch is unchanged after the dependency rebase, and the locked lifecycle plus rebuilt Python binding verification pass on Lance beta.11. The macOS test split retains doctests, library tests, and integration tests; this workspace has no binary test targets, and Linux continues to build the compile-only examples.
The remaining non-blocking risks are unchanged: execution is verified only against the in-process Flight SQL service; standard hosted endpoint discovery still requires an explicit sql_host_override; and the server-admitted connection registry has no demonstrated workload memory bound. This supports explicitly configured endpoints with server-side admission control.
wjones127
left a comment
There was a problem hiding this comment.
Looks good. Only non-blocking feedback now. Nice work on this!
…4632) ## Summary #3971 added `test_zero_lifetime_token_is_refreshed`, but its expected headers omit `x-lancedb-credential-type: oidc`, which `OAuthProvider.get_headers()` has emitted since #2631/#4070. The test fails against current main and breaks the PR CI matrix for every open PR. ## Changes - Align the two zap assertions in `test_zero_lifetime_token_is_refreshed` with the provider contract (see `test_token_refresh` and `test_sync_method`). ## Tests - `pytest python/tests/test_header_provider.py -q`
Summary
Add SQL execution to remote LanceDB connections. On the standard synchronous connection,
execute_querywaits for the initial result stream and returns its Arrow reader.execute_query_asyncis called without Pythonawaitand immediately returns a query handle for status inspection, streaming, or cancellation. Local databases report that SQL is not supported.The transport and query lifecycle live in Rust. Python exposes native-backed synchronous and asynchronous connection methods and query wrappers; it does not use PyArrow's Flight client.
User experience
The standard synchronous connection supports both direct reads and background query execution:
The less commonly used asynchronous connection exposes the same operations as coroutines:
The UUIDv7 query id is scoped to the connection that submitted it. The connection retains lightweight shared query state used by
query.describe()anddb.describe_query(query.id); the id does not encode SQL or a Flight continuation token and is not a cross-connection resume token. Abandoned state has bounded retention, and terminal state remains available briefly.Unqualified table names use the connected database and the
publicnamespace by default.default_namespace_pathaccepts a list such as["production", "events"]. SQL can still use qualified names to reference other databases and namespaces available to the deployment.Design
PollFlightInfofor submission and long polling,DoGetfor results, andCancelFlightInfofor cancellation. EachPollInfo.infois treated as the cumulative set of currently available endpoints, so advertised tickets are consumed once and batches can be delivered before execution is complete.cancellingand wakes blocked status/result work; a later retry can confirmcancelled. Result retrieval is rejected after cancellation is accepted, while cancellation after a result was already delivered is a no-op.reader()through the end of streaming; connect and read timeouts continue to bound their individual phases.