Fix backtest benchmark read after optional table probe
Deploy / lint (push) Successful in 17s
Deploy / test (push) Successful in 2m34s
Deploy / deploy (push) Successful in 53s

This commit is contained in:
dennisthiessen committed 2026-09-25 13:17:51 +02:00
1 parent 9846977d00
commit 9c48eb20c5
2 files changed
+32 -3

No files matched your search

+6 -3
View File
@@ -937,13 +937,16 @@ async def _load_research_rank_only_symbols(db: AsyncSession) -> set[str]:
"""Symbols that feed signal IC only (no GTL/candidate replay).
Optional side table ``research_rank_only`` on research snapshots. Missing
table → empty set (production path unchanged).
table → empty set (production path unchanged). Probe within a savepoint:
PostgreSQL aborts the current transaction after a missing-table error, so
catching that error alone would break the subsequent benchmark read.
"""
from sqlalchemy import text
try:
result = await db.execute(text("SELECT symbol FROM research_rank_only"))
return {str(row[0]).upper() for row in result.fetchall() if row[0]}
async with db.begin_nested():
result = await db.execute(text("SELECT symbol FROM research_rank_only"))
return {str(row[0]).upper() for row in result.fetchall() if row[0]}
except Exception:
return set()