Clean up and less debug

This commit is contained in:
2024-04-07 17:31:35 -04:00
parent f0401d8fda
commit 7d955ff90f
2 changed files with 9 additions and 5 deletions

View File

@@ -703,6 +703,7 @@ def sql_select(
sql_fulltext_match_against = '' sql_fulltext_match_against = ''
if fulltext_qry_dict: if fulltext_qry_dict:
log.info('Creating partial SQL string for fulltext search.')
sql_fulltext_match_against, data_qry = sql_fulltext_qry_part(fulltext_qry_dict) sql_fulltext_match_against, data_qry = sql_fulltext_qry_part(fulltext_qry_dict)
# NOTE: Merge the data_qry result with the data dict # NOTE: Merge the data_qry result with the data dict
@@ -710,6 +711,7 @@ def sql_select(
sql_and_qry = '' sql_and_qry = ''
if and_qry_dict: if and_qry_dict:
log.info('Creating partial SQL string for AND search (equals).')
sql_and_qry, data_qry = sql_and_qry_part(and_qry_dict) sql_and_qry, data_qry = sql_and_qry_part(and_qry_dict)
# NOTE: Merge the data_qry result with the data dict # NOTE: Merge the data_qry result with the data dict
@@ -717,6 +719,7 @@ def sql_select(
sql_and_like = '' sql_and_like = ''
if and_like_dict: if and_like_dict:
log.info('Creating partial SQL string for AND search (LIKE).')
sql_and_like, data_qry = sql_and_like_part(and_like_dict) sql_and_like, data_qry = sql_and_like_part(and_like_dict)
# NOTE: Merge the data_qry result with the data dict # NOTE: Merge the data_qry result with the data dict
@@ -724,6 +727,7 @@ def sql_select(
sql_and_in_dict_li = '' sql_and_in_dict_li = ''
if and_in_dict_li: if and_in_dict_li:
log.info('Creating partial SQL string for AND search (IN).')
sql_and_in_dict_li, data_qry = sql_and_in_dict_li_part(and_in_dict_li) sql_and_in_dict_li, data_qry = sql_and_in_dict_li_part(and_in_dict_li)
# NOTE: Merge the data_qry result with the data dict # NOTE: Merge the data_qry result with the data dict
@@ -845,7 +849,7 @@ def sql_select(
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL # log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(sql) log.debug(sql)
log.debug(data) log.debug(data)
# log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
result = run_sql_select(sql=sql, data=data) result = run_sql_select(sql=sql, data=data)
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL # log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
@@ -1725,7 +1729,7 @@ def sql_and_qry_part(
def sql_and_like_part( def sql_and_like_part(
and_like_dict_obj: dict, # One or more key value pairs. key = field name; value = search string and_like_dict_obj: dict, # One or more key value pairs. key = field name; value = search string
) -> bool|dict: ) -> bool|dict:
log.setLevel(logging.WARNING) log.setLevel(logging.INFO)
log.debug(locals()) log.debug(locals())
data = {} data = {}

View File

@@ -251,7 +251,7 @@ async def get_obj_li(
jp_obj = None jp_obj = None
if jp: if jp:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug( urllib.parse.unquote(jp) ) log.debug( urllib.parse.unquote(jp) )
try: try:
jp_obj = json.loads(urllib.parse.unquote(jp)) jp_obj = json.loads(urllib.parse.unquote(jp))
@@ -259,7 +259,7 @@ async def get_obj_li(
log.warning(e) log.warning(e)
return mk_resp(data=False, status_code=400, response=commons.response, status_message='The JSON string was not formatted correctly.') return mk_resp(data=False, status_code=400, response=commons.response, status_message='The JSON string was not formatted correctly.')
log.debug(jp_obj) log.info(jp_obj)
if jp_obj.get('ft_qry'): # NOTE: This is for the fulltext query if jp_obj.get('ft_qry'): # NOTE: This is for the fulltext query
fulltext_qry_dict_obj = jp_obj['ft_qry'] fulltext_qry_dict_obj = jp_obj['ft_qry']
@@ -273,7 +273,7 @@ async def 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: