replaced TRUE/FALSE with 1/0 in SQL statements in myems-normalization service

pull/136/MERGE
13621160019@163.com 2022-03-24 14:18:06 +08:00
parent 10ff46bae1
commit 9b43963ac3
2 changed files with 3 additions and 3 deletions

View File

@ -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()

View File

@ -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: