Minor changes
This commit is contained in:
@@ -639,7 +639,7 @@ def sql_select(
|
|||||||
log.info('Executing with SQL statement only...')
|
log.info('Executing with SQL statement only...')
|
||||||
result = db.execute(sql)
|
result = db.execute(sql)
|
||||||
except OperationalError as e:
|
except OperationalError as e:
|
||||||
log.error('An operational error exception happended. This is likely a "MySQL server has gone away" error. Going to try again...')
|
log.error('An operational error exception happened. This is likely a "MySQL server has gone away" error. Going to try again...')
|
||||||
log.exception('**** *** ** * ### BEGIN ### Operational Exception Happened: Trying again... * ** *** ****')
|
log.exception('**** *** ** * ### BEGIN ### Operational Exception Happened: Trying again... * ** *** ****')
|
||||||
log.error('^^^^ ^^^ ^^ ^ ### END ### Operational Exception ^ ^^ ^^^ ^^^^')
|
log.error('^^^^ ^^^ ^^ ^ ### END ### Operational Exception ^ ^^ ^^^ ^^^^')
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from app.log import log, logging
|
|||||||
# Import the routers here first:
|
# Import the routers here first:
|
||||||
from app.routers import aether_cfg, api_crud, api, importing, sql, account, activity_log, address, archive, archive_content, contact, cont_edu_cert, cont_edu_cert_person, data_store, event, event_badge, event_badge_template, event_device, event_exhibit, event_exhibit_tracking, event_file, event_importing, event_location, event_person, event_person_detail, event_person_tracking, event_presentation, event_presenter, event_registration, event_session, flask_cfg, fundraising, hosted_file, journal, journal_entry, log_client_viewing, lookup, membership_cfg, membership_group, membership_person_group, membership_person, membership_person_profile, membership_type, membership_person_type, order, order_v3, order_line, order_cart, organization, page, person, person_user, post, post_comment, product, qr, site, site_domain, user, websockets, e_cvent, c_idaa, e_impexium, e_stripe
|
from app.routers import aether_cfg, api_crud, api, importing, sql, account, activity_log, address, archive, archive_content, contact, cont_edu_cert, cont_edu_cert_person, data_store, event, event_badge, event_badge_template, event_device, event_exhibit, event_exhibit_tracking, event_file, event_importing, event_location, event_person, event_person_detail, event_person_tracking, event_presentation, event_presenter, event_registration, event_session, flask_cfg, fundraising, hosted_file, journal, journal_entry, log_client_viewing, lookup, membership_cfg, membership_group, membership_person_group, membership_person, membership_person_profile, membership_type, membership_person_type, order, order_v3, order_line, order_cart, organization, page, person, person_user, post, post_comment, product, qr, site, site_domain, user, websockets, e_cvent, c_idaa, e_impexium, e_stripe
|
||||||
|
|
||||||
from app.db_sql import db, sql_select # , sql_connect
|
from app.db_sql import sql_select # , sql_connect
|
||||||
|
|
||||||
|
|
||||||
print('### **** *** ** * The Aether FastAPI API is loading... * ** *** **** ###')
|
print('### **** *** ** * The Aether FastAPI API is loading... * ** *** **** ###')
|
||||||
@@ -604,6 +604,8 @@ async def sql_test(response: Response = Response):
|
|||||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARN, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARN, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
|
return mk_resp(data=False, status_code=501, response=response)
|
||||||
|
|
||||||
log.info('Getting all accounts from DB...')
|
log.info('Getting all accounts from DB...')
|
||||||
|
|
||||||
sql = text(
|
sql = text(
|
||||||
|
|||||||
@@ -325,6 +325,99 @@ async def get_obj(
|
|||||||
return mk_resp(data=False, status_code=404, response=response)
|
return mk_resp(data=False, status_code=404, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
# @router.patch('/{obj_type_l1}/{obj_id}')
|
||||||
|
# @router.patch('/{obj_type_l1}/{obj_type_l2}/{obj_id}')
|
||||||
|
# @router.patch('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/{obj_id}')
|
||||||
|
# async def patch_obj(
|
||||||
|
# obj_type_l1: Optional[str] = Query(..., max_length=50),
|
||||||
|
# obj_type_l2: str=None,
|
||||||
|
# obj_type_l3: str=None,
|
||||||
|
# obj_id: str = Query(..., min_length=11, max_length=22),
|
||||||
|
|
||||||
|
# for_obj_type: Optional[str] = Query(None, max_length=50),
|
||||||
|
# for_obj_id: Optional[str] = Query(None, max_length=22),
|
||||||
|
|
||||||
|
# x_account_id: str = Header(...),
|
||||||
|
# qry_str: Optional[str] = Query(None, max_length=50),
|
||||||
|
# qry_int: Optional[int] = None,
|
||||||
|
# by_alias: Optional[bool] = True,
|
||||||
|
# include: Optional[list] = [],
|
||||||
|
# exclude: Optional[list] = [],
|
||||||
|
# exclude_unset: Optional[bool] = True,
|
||||||
|
# exclude_none: Optional[bool] = True,
|
||||||
|
# response: Response = Response,
|
||||||
|
|
||||||
|
# commons: Common_Route_Params = Depends(common_route_params),
|
||||||
|
# ):
|
||||||
|
# """
|
||||||
|
# Simple select object type with an ID:
|
||||||
|
# - **obj_type_l1, obj_type_l2, obj_type_l3**:
|
||||||
|
# - Examples:
|
||||||
|
# - /account = account
|
||||||
|
# - /user = user
|
||||||
|
# - /user/role = user_role
|
||||||
|
# - /event = event
|
||||||
|
# - /event/exhibit = event_exhibit
|
||||||
|
# - /order = order
|
||||||
|
# - /order/cart = order_cart
|
||||||
|
# - /order/cart/line = order_cart_line
|
||||||
|
# - /lu/some_lookup = lu_some_lookup
|
||||||
|
# """
|
||||||
|
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
# log.debug(locals())
|
||||||
|
|
||||||
|
# debug_data = {}
|
||||||
|
# debug_data['obj_type_l1'] = obj_type_l1
|
||||||
|
# debug_data['obj_type_l2'] = obj_type_l2
|
||||||
|
# debug_data['obj_type_l3'] = obj_type_l3
|
||||||
|
# debug_data['obj_id'] = obj_id
|
||||||
|
# debug_data['for_obj_type'] = for_obj_type
|
||||||
|
# debug_data['for_obj_id'] = for_obj_id
|
||||||
|
|
||||||
|
# log.debug(debug_data)
|
||||||
|
|
||||||
|
# if obj_type_l1 and obj_type_l2 and obj_type_l3:
|
||||||
|
# obj_name = f'{obj_type_l1}_{obj_type_l2}_{obj_type_l3}'
|
||||||
|
# if obj_name in obj_type_li:
|
||||||
|
# #table_name = obj_type_li[obj_name]
|
||||||
|
# #table_name = obj_type_li[obj_name]['table_name']
|
||||||
|
# pass
|
||||||
|
# else:
|
||||||
|
# return mk_resp(data=False, status_code=400, response=commons.response)
|
||||||
|
# elif obj_type_l1 and obj_type_l2:
|
||||||
|
# obj_name = f'{obj_type_l1}_{obj_type_l2}'
|
||||||
|
# if obj_name in obj_type_li:
|
||||||
|
# #table_name = obj_type_li[obj_name]['table_name']
|
||||||
|
# pass
|
||||||
|
# else:
|
||||||
|
# return mk_resp(data=False, status_code=400, response=commons.response)
|
||||||
|
# elif obj_type_l1:
|
||||||
|
# obj_name = f'{obj_type_l1}'
|
||||||
|
# if obj_name in obj_type_li:
|
||||||
|
# #table_name = obj_type_li[obj_name]['table_name']
|
||||||
|
# pass
|
||||||
|
# else:
|
||||||
|
# return mk_resp(data=False, status_code=400, response=commons.response)
|
||||||
|
# else:
|
||||||
|
# log.warning('We should not be here')
|
||||||
|
# return mk_resp(data=False, status_code=400, response=commons.response)
|
||||||
|
|
||||||
|
# table_name = obj_type_li[obj_name]['table_name']
|
||||||
|
|
||||||
|
# # NOTE: Add a check for the object ID... assuming it is a random ID string for now.
|
||||||
|
# if sql_result := sql_select(table_name=table_name, record_id_random=obj_id):
|
||||||
|
# log.debug(sql_result)
|
||||||
|
|
||||||
|
# base_name = obj_type_li[obj_name]['base_name']
|
||||||
|
# resp_data = base_name(**sql_result).dict(by_alias=commons.by_alias, exclude_unset=commons.exclude_unset)
|
||||||
|
|
||||||
|
# return mk_resp(data=resp_data, response=response) #, details=debug_data)
|
||||||
|
# else:
|
||||||
|
# log.debug(sql_result)
|
||||||
|
# return mk_resp(data=False, status_code=404, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete('/{obj_type_l1}/{obj_id}')
|
@router.delete('/{obj_type_l1}/{obj_id}')
|
||||||
@router.delete('/{obj_type_l1}/{obj_type_l2}/{obj_id}')
|
@router.delete('/{obj_type_l1}/{obj_type_l2}/{obj_id}')
|
||||||
@router.delete('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/{obj_id}')
|
@router.delete('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/{obj_id}')
|
||||||
|
|||||||
Reference in New Issue
Block a user