Skip to content

Commit

Permalink
Fixing NULL handling error in SQL generation (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamachor authored Aug 13, 2024
1 parent 4175a64 commit 1d79acb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metrics/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
return f"({lhs} IN ({str_list}) {null_predicate})"

0 comments on commit 1d79acb

Please sign in to comment.