Bug fix for missing ID. Less debug as well.

This commit is contained in:
Scott Idem
2024-10-08 12:52:48 -04:00
parent e13ce42cac
commit cd0d3fe9d5
2 changed files with 6 additions and 6 deletions

View File

@@ -1312,7 +1312,7 @@ def redis_lookup_id_random(
# WARNING WARNING WARNING # WARNING WARNING WARNING
# WARNING WARNING WARNING # WARNING WARNING WARNING
log.info(f'Looking up ID in Redis is being partially bypassed. Key="{key_name}" value="{record_id}" TTL={r.ttl(key_name)} seconds') log.info(f'Looking up ID in Redis is being partially bypassed. Key="{key_name}" value="{record_id}" TTL={r.ttl(key_name)} seconds')
record_id = None # Uncommment this line to bypass the Redis lookup... trust? record_id = None # Uncomment this line to bypass the Redis lookup... trust?
# WARNING WARNING WARNING # WARNING WARNING WARNING
# WARNING WARNING WARNING # WARNING WARNING WARNING
# WARNING WARNING WARNING # WARNING WARNING WARNING
@@ -1335,7 +1335,7 @@ def redis_lookup_id_random(
log.debug(f'SQL SELECT result: {select_results}') log.debug(f'SQL SELECT result: {select_results}')
# log.debug(type(select_results)) # log.debug(type(select_results))
if isinstance(select_results, dict): if isinstance(select_results, dict):
log.info(f"""Record ID random found: {str(select_results['id'])}""") log.info(f"""Record ID random found: {str(select_results.get('id'))}""")
if record_id := select_results.get('id'): if record_id := select_results.get('id'):
r.setex(key_name, datetime.timedelta(minutes=minutes), value=record_id) r.setex(key_name, datetime.timedelta(minutes=minutes), value=record_id)

View File

@@ -367,7 +367,7 @@ def handle_get_obj_li(
commons: Common_Route_Params = None, commons: Common_Route_Params = None,
): ):
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals()) log.debug(locals())
import urllib import urllib
@@ -414,7 +414,7 @@ def handle_get_obj_li(
if jp_obj.get('and_in_li'): # NOTE: This is for the additional AND IN clauses in the WHERE statement if jp_obj.get('and_in_li'): # NOTE: This is for the additional AND IN clauses in the WHERE statement
and_in_dict_li_obj = jp_obj['and_in_li'] and_in_dict_li_obj = jp_obj['and_in_li']
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if order_by_li: if order_by_li:
@@ -539,7 +539,7 @@ def handle_get_obj_li(
if sql_result: if sql_result:
if isinstance(sql_result, list): if isinstance(sql_result, list):
log.setLevel(logging.INFO) log.setLevel(logging.WARNING)
resp_data_li = [] resp_data_li = []
for record in sql_result: for record in sql_result:
if base_name: if base_name:
@@ -552,7 +552,7 @@ def handle_get_obj_li(
column_name_li = list(sql_result[0].keys()) # This should be the same for all records in the list. column_name_li = list(sql_result[0].keys()) # This should be the same for all records in the list.
if return_file: if return_file:
log.setLevel(logging.DEBUG) log.setLevel(logging.INFO)
# We want to handle any field that has a suffix of _json. It should be expanded into a list of fields that are prefixed with the original field name minus _json. # We want to handle any field that has a suffix of _json. It should be expanded into a list of fields that are prefixed with the original field name minus _json.