cur = conn.cursor()
l = len(anomalies)
for i in range(l):
row = anomalies.iloc[i]
qry = f"""
INSERT INTO tbl_anomaly_result (mdate, udate, home_code, gas, elec, water )
VALUES
( NOW(), NOW(), 'G0205020605', {row['water_use_value']}, {row['gas_use_value']}, {row['elec_use_value']} )
ON CONFLICT ( home_code, mdate )
DO update set gas = excluded.gas, elec = excluded.elec, water = excluded.water;
"""
row = cur.fetchone()
cur.execute(qry)
conn.commit()
파이썬으로 구현된 SQL 코드 인데용.. 이걸 배치파일로돌리면 맨위의 데이터만 읽고 저장 하더라구요.. 다음행의 데이터를 읽고 분석결과를 저장해야하는데
어떻게 해야할지 모르겠네요.