From 45d14cc7b2bfe1e78953f75fc36a6e3cc16725b7 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 6 Mar 2024 19:51:38 -0500 Subject: [PATCH] Bug fix for null results SQL SELECT --- app/db_sql.py | 4 ++-- app/methods/e_confex_methods.py | 8 ++++---- app/routers/api_crud.py | 2 +- app/routers/e_confex.py | 2 -- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/db_sql.py b/app/db_sql.py index 94b93bc..5c7a08e 100644 --- a/app/db_sql.py +++ b/app/db_sql.py @@ -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() diff --git a/app/methods/e_confex_methods.py b/app/methods/e_confex_methods.py index 50759c9..d1088e9 100644 --- a/app/methods/e_confex_methods.py +++ b/app/methods/e_confex_methods.py @@ -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 diff --git a/app/routers/api_crud.py b/app/routers/api_crud.py index e4e7006..f0a5f6c 100644 --- a/app/routers/api_crud.py +++ b/app/routers/api_crud.py @@ -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} diff --git a/app/routers/e_confex.py b/app/routers/e_confex.py index 0919d0e..bb85914 100644 --- a/app/routers/e_confex.py +++ b/app/routers/e_confex.py @@ -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