Cleaned up and easier debugging for SQL statements. A lot less redundant information.
This commit is contained in:
@@ -218,7 +218,7 @@ def create_hosted_file_link(
|
||||
link_to_type: str,
|
||||
link_to_id: int|str,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
if account_id := redis_lookup_id_random(record_id_random=account_id, table_name='account'): pass
|
||||
@@ -234,8 +234,15 @@ def create_hosted_file_link(
|
||||
hosted_file_link_data['link_to_type'] = link_to_type # Should this be renamed to "link_to_type" for clarity?
|
||||
hosted_file_link_data['link_to_id'] = link_to_id # Should this be renamed to "link_to_id" for clarity?
|
||||
|
||||
# NOTE: Currently sql_insert does not handel all successful inserts correctly. If there is not an autonum ID then it will return 0 as the ID.
|
||||
if hosted_file_link_data_in_result := sql_insert(data=hosted_file_link_data, table_name='hosted_file_link', id_random_length=0): pass # This should be improved
|
||||
hosted_file_link_data['test'] = 'test'
|
||||
|
||||
# NOTE: Currently sql_insert does not handle all successful inserts correctly. If there is not an autonum ID then it will return 0 as the ID.
|
||||
if hosted_file_link_data_in_result := sql_insert(data=hosted_file_link_data, table_name='hosted_file_link', id_random_length=0):
|
||||
log.info('The hosted_file_link was created.')
|
||||
pass # This should be improved
|
||||
elif hosted_file_link_data_in_result is None:
|
||||
log.info('The hosted_file_link probably already exists.')
|
||||
return None
|
||||
else:
|
||||
# This should be improved
|
||||
log.warning('Because the hosted_file_link table does not have a primary autonum this check is incorrect even when successful.')
|
||||
|
||||
Reference in New Issue
Block a user