Files
kis_bot/scratch/update_ls_limit3.py

22 lines
717 B
Python

from database import TradeDB
db = TradeDB()
try:
# row 존재하는지 확인
row = db.conn.execute("SELECT id, LS_WS_MAX_SUBSCRIPTIONS FROM env_config LIMIT 1").fetchone()
if row:
print("기존 값:", dict(row))
db.conn.execute("UPDATE env_config SET LS_WS_MAX_SUBSCRIPTIONS='400' WHERE id=%s", (row['id'],))
print("UPDATE 완료")
else:
db.conn.execute("INSERT INTO env_config (LS_WS_MAX_SUBSCRIPTIONS) VALUES ('400')")
print("INSERT 완료")
db.conn.commit()
# 확인
new_row = db.conn.execute("SELECT LS_WS_MAX_SUBSCRIPTIONS FROM env_config LIMIT 1").fetchone()
print("변경 후 값:", dict(new_row))
finally:
db.close()