feat(sdk): expose table overrides for remote tables

Expose table-level maintenance override read, update, and reset APIs for remote
Rust and Python tables. Local tables continue to return `NotSupported`.

Updates recursively merge the caller-provided JSON object into the current
override document so unrelated and unknown service fields are preserved. Reset
uses the explicit reset endpoint.

The integrated change keeps current main's remote database identity, namespace,
branch, SQL, WAL, and threaded mock-server behavior.

Validated with focused Rust and Python override tests and the complete applicable
CI run for 43bccbadc5.
This commit is contained in:
Bruno Ramirez
2026-10-31 10:44:57 +08:00
committed by GitHub
parent 1022e91434
commit 5f7ec4e0a2
11 changed files with 596 additions and 1 deletions
+60
View File
@@ -1933,6 +1933,66 @@ def test_create_index_method(mock_create_index, mem_db: DBConnection):
)
@patch("lancedb.table.AsyncTable.get_table_overrides")
def test_get_table_overrides_method(mock_get_table_overrides, mem_db: DBConnection):
expected = {"job_types": {"cleanup": {"enabled": False}}}
mock_get_table_overrides.return_value = expected
table = mem_db.create_table("test", data=[{"id": 1}])
assert table.get_table_overrides() == expected
mock_get_table_overrides.assert_called_once_with()
@patch("lancedb.table.AsyncTable.update_table_overrides")
def test_update_table_overrides_method(
mock_update_table_overrides, mem_db: DBConnection
):
overrides = {
"job_types": {
"cleanup": {"enabled": False},
"index": {
"scalar": {
"reindex": {
"row_threshold": 1000,
"ttl_millis": 300000,
}
}
},
}
}
mock_update_table_overrides.return_value = overrides
table = mem_db.create_table("test", data=[{"id": 1}])
assert table.update_table_overrides(**overrides) == overrides
mock_update_table_overrides.assert_called_once_with(**overrides)
@patch("lancedb.table.AsyncTable.reset_table_overrides")
def test_reset_table_overrides_method(mock_reset_table_overrides, mem_db: DBConnection):
expected = {}
mock_reset_table_overrides.return_value = expected
table = mem_db.create_table("test", data=[{"id": 1}])
assert table.reset_table_overrides() == expected
mock_reset_table_overrides.assert_called_once_with()
@pytest.mark.asyncio
async def test_async_update_table_overrides_encodes_json():
class MockInner:
async def update_table_overrides(self, encoded_overrides):
assert json.loads(encoded_overrides) == {
"job_types": {"cleanup": {"enabled": False}}
}
return json.dumps({"job_types": {"cleanup": {"enabled": False}}})
table = lancedb.table.AsyncTable(MockInner())
assert await table.update_table_overrides(
job_types={"cleanup": {"enabled": False}}
) == {"job_types": {"cleanup": {"enabled": False}}}
@pytest.mark.parametrize("api", ["legacy", "unified"])
@pytest.mark.parametrize("cuda_failure", ["unavailable", "init_error"])
def test_create_index_cuda_failure_suggests_cpu(