mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-27 15:12:53 +00:00
### Changes to sync API * Updated `LanceTable` and `LanceDBConnection` reprs * Add `storage_options`, `data_storage_version`, and `enable_v2_manifest_paths` to sync create table API. * Add `storage_options` to `open_table` in sync API. * Add `list_indices()` and `index_stats()` to sync API * `create_table()` will now create only 1 version when data is passed. Previously it would always create two versions: 1 to create an empty table and 1 to add data to it. ### Changes to async API * Add `embedding_functions` to async `create_table()` API. * Added `head()` to async API ### Refactors * Refactor index parameters into dataclasses so they are easier to use from Python * Moved most tests to use an in-memory DB so we don't need to create so many temp directories Closes #1792 Closes #1932 --------- Co-authored-by: Weston Pace <weston.pace@gmail.com>
33 lines
840 B
Python
33 lines
840 B
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright The LanceDB Authors
|
|
|
|
from datetime import timedelta
|
|
from lancedb.db import AsyncConnection, DBConnection
|
|
import lancedb
|
|
import pytest
|
|
import pytest_asyncio
|
|
|
|
|
|
# Use an in-memory database for most tests.
|
|
@pytest.fixture
|
|
def mem_db() -> DBConnection:
|
|
return lancedb.connect("memory://")
|
|
|
|
|
|
# Use a temporary directory when we need to inspect the database files.
|
|
@pytest.fixture
|
|
def tmp_db(tmp_path) -> DBConnection:
|
|
return lancedb.connect(tmp_path)
|
|
|
|
|
|
@pytest_asyncio.fixture
|
|
async def mem_db_async() -> AsyncConnection:
|
|
return await lancedb.connect_async("memory://")
|
|
|
|
|
|
@pytest_asyncio.fixture
|
|
async def tmp_db_async(tmp_path) -> AsyncConnection:
|
|
return await lancedb.connect_async(
|
|
tmp_path, read_consistency_interval=timedelta(seconds=0)
|
|
)
|