fix: full force_rebuild 시 universe_snapshot 전체 삭제

tickers=None (전체 빌드)일 때 registry에서 제거된 stale 티커 데이터도
정리되도록 DELETE FROM universe_snapshot 실행.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
I Luk Kim 5 months ago
parent e51e045169
commit 1b037c9256

@ -290,14 +290,19 @@ class UniverseService:
)
if force_rebuild:
# Delete in chunks to avoid huge IN clauses
for i in range(0, len(ticker_list), _CHUNK):
chunk = ticker_list[i:i + _CHUNK]
await db.execute(
UniverseSnapshot.__table__.delete().where(
UniverseSnapshot.ticker.in_(chunk)
if not tickers:
# Full rebuild: wipe ALL snapshots (also removes stale tickers
# that were de-registered from the registry)
await db.execute(UniverseSnapshot.__table__.delete())
else:
# Partial rebuild: delete only the requested tickers
for i in range(0, len(ticker_list), _CHUNK):
chunk = ticker_list[i:i + _CHUNK]
await db.execute(
UniverseSnapshot.__table__.delete().where(
UniverseSnapshot.ticker.in_(chunk)
)
)
)
await db.commit()
# Load registry metadata (sector/industry/exchange/CIK)

Loading…
Cancel
Save