Bug fix for null results SQL SELECT

This commit is contained in:
Scott Idem
2024-03-06 19:51:38 -05:00
parent 852df91c7a
commit 45d14cc7b2
4 changed files with 7 additions and 9 deletions

View File

@@ -842,7 +842,7 @@ def sql_select(
# NOTE: My custom sql_result_proxy_to_dict_simple(result_proxy=result.first()) is slower than using dict().
# NOTE: list(result) was tested seems to be the slowest. Slower than my custom function.
if result.rowcount == 1:
if result and result.rowcount == 1:
log.info(f'Found one record. as_dict={as_dict}, as_list={as_list}')
if as_dict:
record = dict(result.first())
@@ -856,7 +856,7 @@ def sql_select(
else:
log.debug(record)
return record # Successful
elif result.rowcount > 1:
elif result and result.rowcount > 1:
log.info(f'Found {result.rowcount} records. as_dict={as_dict}, as_list={as_list}')
if as_dict:
#timer_1_start = timer()