Files
kis_bot/scratch/find_env.py

32 lines
1.3 KiB
Python

from database import TradeDB
import json
db = TradeDB()
try:
# 1. env_config의 최신 row를 읽어서 JSON으로 확인해본다.
row1 = db.conn.execute("SELECT * FROM env_config ORDER BY id DESC LIMIT 1").fetchone()
# 2. env_config_ext (있다면)
row2 = db.conn.execute("SELECT * FROM env_config_ext ORDER BY id DESC LIMIT 1").fetchone()
# 3. 만약 JSON TEXT 컬럼이 있다면?
print("--- env_config ---")
if row1:
for k, v in dict(row1).items():
if 'LS_WS_MAX_SUBSCRIPTIONS' in str(k) or 'LS_WS_MAX_SUBSCRIPTIONS' in str(v):
print(f"FOUND IN env_config: {k} = {v}")
print("--- env_config_ext ---")
if row2:
for k, v in dict(row2).items():
if 'LS_WS_MAX_SUBSCRIPTIONS' in str(k) or 'LS_WS_MAX_SUBSCRIPTIONS' in str(v):
print(f"FOUND IN env_config_ext: {k} = {v}")
# 4. overflow 테이블이나 다른 방식인지 확인
print("--- get_merged_env_snapshot ---")
snapshot = db.get_merged_env_snapshot()
if 'LS_WS_MAX_SUBSCRIPTIONS' in snapshot:
print("FOUND IN snapshot:", snapshot['LS_WS_MAX_SUBSCRIPTIONS'])
print("--- check if overflow table exists ---")
tables = [r[0] for r in db.conn.execute("SHOW TABLES").fetchall()]
print([t for t in tables if 'env' in t])
finally:
db.close()