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()

View File

@@ -83,7 +83,7 @@ def get_event_session_list(
log.warning('Something may have gone wrong during the request.')
# log.warning('Something may have gone wrong. Setting the API app_user_token_datetime value to None to re-authenticate with Impexium on the next request.')
# log.warning('Something may have gone wrong. Setting the API app_user_token_datetime value to None to re-authenticate with Confex on the next request.')
# api['app_user_token_datetime'] = None # Resetting this just in case the App and or User token expired.
return confex_session_list
@@ -152,7 +152,7 @@ def get_event_session_detail(
log.warning('Something may have gone wrong during the request.')
# log.warning('Something may have gone wrong. Setting the API app_user_token_datetime value to None to re-authenticate with Impexium on the next request.')
# log.warning('Something may have gone wrong. Setting the API app_user_token_datetime value to None to re-authenticate with Confex on the next request.')
# api['app_user_token_datetime'] = None # Resetting this just in case the App and or User token expired.
return confex_session_detail
@@ -223,7 +223,7 @@ def get_event_presentation_detail(
log.warning('Something may have gone wrong during the request.')
# log.warning('Something may have gone wrong. Setting the API app_user_token_datetime value to None to re-authenticate with Impexium on the next request.')
# log.warning('Something may have gone wrong. Setting the API app_user_token_datetime value to None to re-authenticate with Confex on the next request.')
# api['app_user_token_datetime'] = None # Resetting this just in case the App and or User token expired.
return confex_presentation_detail
@@ -294,7 +294,7 @@ def get_event_presenter_detail(
log.warning('Something may have gone wrong during the request.')
# log.warning('Something may have gone wrong. Setting the API app_user_token_datetime value to None to re-authenticate with Impexium on the next request.')
# log.warning('Something may have gone wrong. Setting the API app_user_token_datetime value to None to re-authenticate with Confex on the next request.')
# api['app_user_token_datetime'] = None # Resetting this just in case the App and or User token expired.
return confex_presenter_detail

View File

@@ -140,7 +140,7 @@ obj_type_li['event'] = {'table_name': 'v_event', 'table_name_alt': 'v_event_w_fi
'tbl_name_update': 'event', 'base_name': Event_Base, 'base_name_alt': Event_Meeting_Flat_Base}
obj_type_li['event_abstract'] = {'table_name': 'v_event_abstract', 'tbl_name_update': 'event_abstract', 'base_name': Event_Abstract_In}
obj_type_li['event_badge'] = {'table_name': 'event_badge', 'table_name_alt': 'v_event_badge', 'tbl_name_update': 'event_badge', 'base_name': Event_Badge_Base}
obj_type_li['event_badge'] = {'table_name': 'event_badge', 'table_name_alt': 'v_event_badge', 'tbl_name_update': 'event_badge', 'base_name': Event_Badge_Base, 'base_name_alt': Event_Badge_Basic_Base}
#obj_type_li['event_badge_log'] = {'table_name': 'event_badge_log', 'tbl_name_update': 'event_badge_log', 'base_name': Event_Badge_Log_Base}
#obj_type_li['event_badge_template'] = {'table_name': 'event_badge_template', 'tbl_name_update': 'event_badge_template', 'base_name': Event_Badge_Template_Base}
#obj_type_li['event_device'] = {'table_name': 'event_device', 'tbl_name_update': 'event_device', 'base_name': Event_Device_Base}

View File

@@ -10,8 +10,6 @@ from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select,
from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
from app.methods.e_impexium_methods import get_custom_fields, get_events, get_event_registrants, get_individual_custom_fields, get_individual_profile
from app.methods.event_presentation_methods import create_update_event_presentation_obj_v4
from app.methods.event_presenter_methods import create_update_event_presenter_obj_v4
from app.methods.event_session_methods import create_update_event_session_obj_v4