Wire datetime_columns through query params and reads; add db_size and vacuum guard

This commit is contained in:
Jan Doubravský
2026-06-10 13:58:29 +02:00
parent 8e46ee3547
commit a68b8994e3
13 changed files with 383 additions and 20 deletions
+18
View File
@@ -288,3 +288,21 @@ def test_vacuum_in_memory_is_noop(cache, source_conn):
cache.load_table("users", ["name"], source_conn)
cache.vacuum(incremental=False) # no-op, no error
assert cache.is_table_cached("users") is True
def test_incremental_vacuum_warns_without_incremental_auto_vacuum(tmp_path, source_conn):
"""Incremental vacuum on a DB that isn't auto_vacuum=INCREMENTAL warns and skips."""
from loguru import logger
messages: list[str] = []
sink_id = logger.add(messages.append, level="WARNING", filter="sqlmem")
logger.enable("sqlmem")
try:
c = CacheManager(db_path=tmp_path / "c.db", backup_interval=9999, in_memory=False)
c.load_table("users", ["name"], source_conn)
c.vacuum(incremental=True) # auto_vacuum defaults to NONE → no-op + warning
c.close()
finally:
logger.remove(sink_id)
logger.disable("sqlmem")
assert any("auto_vacuum" in m for m in messages)