fix: asyncpg param 한도 초과 — INSERT CHUNK 2900→2300

interval 컬럼 추가로 row당 파라미터 14개로 증가.
2900 × 14 = 40,600 > 32,767 → InterfaceError 발생.
2300 × 14 = 32,200으로 안전 범위 내 수정.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
I Luk Kim 4 months ago
parent af26df8895
commit e6ea1abb0e

@ -164,8 +164,11 @@ class AlpacaPriceService:
})
if rows:
# Chunk to stay under asyncpg's 32767-param limit (~11 params/row → 2900/chunk)
CHUNK = 2900
# Chunk to stay under asyncpg's 32767-param limit (14 params/row → 2300/chunk)
# 14 params: id/ticker/date/open/high/low/close/volume/vwap/trade_count/
# interval/data_source/created_at/updated_at
# 2300 × 14 = 32,200 < 32,767
CHUNK = 2300
for i in range(0, len(rows), CHUNK):
stmt = pg_insert(AlpacaPriceData).values(rows[i : i + CHUNK])
stmt = stmt.on_conflict_do_nothing(constraint="uq_alpaca_price_data")

Loading…
Cancel
Save