Bug fix for null results SQL SELECT
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user