From 9b43963ac37649dfae503cd14153ffac0c1584f2 Mon Sep 17 00:00:00 2001 From: "13621160019@163.com" <13621160019@163.com> Date: Thu, 24 Mar 2022 14:18:06 +0800 Subject: [PATCH] replaced TRUE/FALSE with 1/0 in SQL statements in myems-normalization service --- myems-normalization/meter.py | 4 ++-- myems-normalization/virtualpoint.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/myems-normalization/meter.py b/myems-normalization/meter.py index f1d4578b..98a1b343 100644 --- a/myems-normalization/meter.py +++ b/myems-normalization/meter.py @@ -207,7 +207,7 @@ def worker(meter): try: query = (" SELECT utc_date_time, actual_value " " FROM tbl_energy_value " - " WHERE point_id = %s AND utc_date_time < %s AND is_bad = FALSE " + " WHERE point_id = %s AND utc_date_time < %s AND is_bad = 0 " " ORDER BY utc_date_time DESC " " LIMIT 1 ") cursor_historical_db.execute(query, (meter['point_id'], start_datetime_utc,)) @@ -235,7 +235,7 @@ def worker(meter): try: query = (" SELECT utc_date_time, actual_value " " FROM tbl_energy_value " - " WHERE point_id = %s AND utc_date_time >= %s AND utc_date_time < %s AND is_bad = FALSE " + " WHERE point_id = %s AND utc_date_time >= %s AND utc_date_time < %s AND is_bad = 0 " " ORDER BY utc_date_time ") cursor_historical_db.execute(query, (meter['point_id'], start_datetime_utc, end_datetime_utc)) rows_energy_values = cursor_historical_db.fetchall() diff --git a/myems-normalization/virtualpoint.py b/myems-normalization/virtualpoint.py index 71575428..49a7297e 100644 --- a/myems-normalization/virtualpoint.py +++ b/myems-normalization/virtualpoint.py @@ -39,7 +39,7 @@ def calculate(logger): try: cursor_system_db.execute(" SELECT id, name, data_source_id, high_limit, low_limit, address " " FROM tbl_points " - " WHERE is_virtual = TRUE AND object_type = 'ANALOG_VALUE' ") + " WHERE is_virtual = 1 AND object_type = 'ANALOG_VALUE' ") rows_virtual_points = cursor_system_db.fetchall() if rows_virtual_points is None or len(rows_virtual_points) == 0: