Skip to content

Commit

Permalink
proper NULL casing
Browse files Browse the repository at this point in the history
  • Loading branch information
dogversioning committed Oct 15, 2024
1 parent f514144 commit 4dee383
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/handlers/dashboard/get_chart_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _build_query(query_params: dict, filters: list, path_params: dict) -> str:
if len(columns) > 0:
coalesce_str = (
f"WHERE COALESCE (cast({' AS VARCHAR), cast('.join(columns)} AS VARCHAR)) "
"IS NOT Null AND"
"IS NOT NULL AND"
)
else:
coalesce_str = "WHERE"
Expand Down
8 changes: 4 additions & 4 deletions tests/dashboard/test_get_chart_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ def mock_data_frame(filter_param):
[],
{"data_package_id": "test_study"},
f'SELECT gender, sum(cnt) as cnt FROM "{TEST_GLUE_DB}"."test_study" '
"WHERE COALESCE (cast(race AS VARCHAR)) IS NOT Null AND gender IS NOT Null "
"WHERE COALESCE (cast(race AS VARCHAR)) IS NOT NULL AND gender IS NOT NULL "
"GROUP BY gender ORDER BY gender",
),
(
{"column": "gender", "stratifier": "race"},
[],
{"data_package_id": "test_study"},
f'SELECT race, gender, sum(cnt) as cnt FROM "{TEST_GLUE_DB}"."test_study" '
"WHERE gender IS NOT Null "
"WHERE gender IS NOT NULL "
"GROUP BY race, gender ORDER BY race, gender",
),
(
{"column": "gender"},
["gender:strEq:female"],
{"data_package_id": "test_study"},
f'SELECT gender, sum(cnt) as cnt FROM "{TEST_GLUE_DB}"."test_study" '
"WHERE COALESCE (cast(race AS VARCHAR)) IS NOT Null AND gender IS NOT Null "
"WHERE COALESCE (cast(race AS VARCHAR)) IS NOT Null AND gender IS NOT NULL "
"AND gender LIKE 'female' "
"GROUP BY gender ORDER BY gender",
),
Expand All @@ -61,7 +61,7 @@ def mock_data_frame(filter_param):
["gender:strEq:female"],
{"data_package_id": "test_study"},
f'SELECT race, gender, sum(cnt) as cnt FROM "{TEST_GLUE_DB}"."test_study" '
"WHERE gender IS NOT Null "
"WHERE gender IS NOT NULL "
"AND gender LIKE 'female' "
"GROUP BY race, gender ORDER BY race, gender",
),
Expand Down

0 comments on commit 4dee383

Please sign in to comment.