Compare commits
1 commit
main
...
fix/connec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0ca693101 |
3 changed files with 19 additions and 2 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **`Store` and CLI commands accept relative database paths again.** The 0.43 migration to `lancedb.connect_async` started routing the path through LanceDB's async URI sanitizer, which treats anything that doesn't look like an absolute local path as a possibly-cloud URI and demands `api_key`/`region`, surfacing as `ValueError: An api_key is required when connecting to LanceDb Cloud`. The path is now resolved to absolute before being handed to LanceDB.
|
||||||
|
|
||||||
## [0.43.0] - 2026-04-24
|
## [0.43.0] - 2026-04-24
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ async def connect_lancedb(
|
||||||
else:
|
else:
|
||||||
if db_path is None:
|
if db_path is None:
|
||||||
raise ValueError("No lancedb.uri configured and no db_path provided")
|
raise ValueError("No lancedb.uri configured and no db_path provided")
|
||||||
return await lancedb.connect_async(db_path)
|
return await lancedb.connect_async(db_path.resolve())
|
||||||
|
|
||||||
|
|
||||||
class DocumentRecord(LanceModel):
|
class DocumentRecord(LanceModel):
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,20 @@ class TestConnectLancedb:
|
||||||
"haiku.rag.store.engine.lancedb.connect_async", new_callable=AsyncMock
|
"haiku.rag.store.engine.lancedb.connect_async", new_callable=AsyncMock
|
||||||
) as mock_connect:
|
) as mock_connect:
|
||||||
await connect_lancedb(config, db_path=temp_db_path)
|
await connect_lancedb(config, db_path=temp_db_path)
|
||||||
mock_connect.assert_called_once_with(temp_db_path)
|
mock_connect.assert_called_once_with(temp_db_path.resolve())
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_local_resolves_relative_db_path(self, tmp_path, monkeypatch):
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
monkeypatch.chdir(tmp_path)
|
||||||
|
relative = Path("db/rag/rag.lancedb")
|
||||||
|
config = AppConfig(lancedb=LanceDBConfig(uri=""))
|
||||||
|
with patch(
|
||||||
|
"haiku.rag.store.engine.lancedb.connect_async", new_callable=AsyncMock
|
||||||
|
) as mock_connect:
|
||||||
|
await connect_lancedb(config, db_path=relative)
|
||||||
|
mock_connect.assert_called_once_with((tmp_path / relative).resolve())
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_cloud_passes_uri_api_key_region(self):
|
async def test_cloud_passes_uri_api_key_region(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue