mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-13 14:16:54 +00:00
fix(python): return the session supplied to LanceDBConnection (#4433)
LanceDBConnection.session read AsyncConnection.session, but AsyncConnection has no session attribute, so access raised AttributeError. Store the session passed to the constructor and return that object. Assisted by Cursor (Grok). Co-authored-by: Preston Zhao <195942578+canyang25@users.noreply.github.com>
This commit is contained in:
co-authored by
Preston Zhao
parent
cc9f01ae26
commit
13df747f18
@@ -36,3 +36,13 @@ def test_session_cache_configuration(tmp_path):
|
||||
assert final_cache_size > initial_cache_size # Cache should have grown
|
||||
assert final_cache_items >= initial_cache_items # Items should not decrease
|
||||
assert initial_cache_size < index_cache_size + metadata_cache_size
|
||||
|
||||
|
||||
def test_connection_session_returns_supplied_session(tmp_path):
|
||||
"""Sync connections must expose the session they were opened with."""
|
||||
db = lancedb.connect(tmp_path)
|
||||
assert db.session is None
|
||||
|
||||
session = lancedb.Session()
|
||||
db = lancedb.connect(tmp_path, session=session)
|
||||
assert db.session is session
|
||||
|
||||
Reference in New Issue
Block a user