Fix backtest benchmark read after optional table probe
This commit is contained in:
1 parent
9846977d00
commit
9c48eb20c5
2 files changed
+32
-3
No files matched your search
@@ -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()
|
||||
|
||||
|
||||
Reference in new issue
Block a user