From 1d79acbcae88a4c04ae99f45dc7000abb2871b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Camacho=20Rodr=C3=ADguez?= Date: Tue, 13 Aug 2024 19:15:05 +0200 Subject: [PATCH] Fixing NULL handling error in SQL generation (#314) --- metrics/app/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metrics/app/utils.py b/metrics/app/utils.py index 82463ec6..299ab63a 100755 --- a/metrics/app/utils.py +++ b/metrics/app/utils.py @@ -75,6 +75,6 @@ def generate_sql_in_with_null(lhs: str, values: list, NA_value = "N/A") -> str: """ str_list = ', '.join(["'" + str(value) + "'" for value in values if value is not NA_value]) - null_predicate = '' if NA_value in values else 'NOT' + null_predicate = f'OR {lhs} IS NULL' if NA_value in values else '' - return f"({lhs} IN ({str_list}) OR {lhs} IS {null_predicate} NULL)" \ No newline at end of file + return f"({lhs} IN ({str_list}) {null_predicate})"