Improved SQL INSERT and UPDATE with JSON or dict values.

This commit is contained in:
Scott Idem
2023-02-08 19:28:45 -05:00
parent d1c373f7fb
commit b66a7f4707
3 changed files with 13 additions and 6 deletions

View File

@@ -145,7 +145,7 @@ def load_event_exhibit_obj(
inc_event_exhibit_tracking_list: bool = False,
inc_event_person: bool = False,
) -> Event_Exhibit_Base|dict|bool:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
# if event_exhibit_id := redis_lookup_id_random(record_id_random=event_exhibit_id, table_name='event_exhibit'): pass

View File

@@ -121,8 +121,8 @@ def update_event_exhibit_tracking_obj(
# NOTE: This is needed for the SQL update to work.
# NOTE: Should something like this be moved to the sql_update and sql_insert functions? If a field ends in _json or the field data type is a dict?
if responses_json := event_exhibit_tracking_dict.get('responses_json'):
event_exhibit_tracking_dict['responses_json'] = json.dumps(responses_json)
# if responses_json := event_exhibit_tracking_dict.get('responses_json'):
# event_exhibit_tracking_dict['responses_json'] = json.dumps(responses_json)
# ### SECTION ### Process data
if event_exhibit_tracking_dict_up_result := sql_update(