From e6ea1abb0ed71ce8211cafb1aaee99936f4372c9 Mon Sep 17 00:00:00 2001 From: I Luk Kim Date: Tue, 14 Apr 2026 03:11:10 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20asyncpg=20param=20=ED=95=9C=EB=8F=84=20?= =?UTF-8?q?=EC=B4=88=EA=B3=BC=20=E2=80=94=20INSERT=20CHUNK=202900=E2=86=92?= =?UTF-8?q?2300?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit interval 컬럼 추가로 row당 파라미터 14개로 증가. 2900 × 14 = 40,600 > 32,767 → InterfaceError 발생. 2300 × 14 = 32,200으로 안전 범위 내 수정. Co-Authored-By: Claude Sonnet 4.6 --- app/services/alpaca_price_service.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/services/alpaca_price_service.py b/app/services/alpaca_price_service.py index ab8698f..3ee5c51 100644 --- a/app/services/alpaca_price_service.py +++ b/app/services/alpaca_price_service.py @@ -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")