Upgrading to fastapi .95.1
This commit is contained in:
@@ -24,6 +24,7 @@ engine = create_engine(url=connection_string, poolclass=NullPool, echo=False, is
|
||||
# levels: "REPEATABLE READ" "READ COMMITTED" "READ UNCOMMITTED" "SERIALIZABLE"
|
||||
|
||||
log.info('DB SQL trying to connect...')
|
||||
db = None
|
||||
try:
|
||||
db = engine.connect()
|
||||
log.info(f'Connected to database: {db_uri}')
|
||||
@@ -932,6 +933,10 @@ def run_sql_select(
|
||||
log.debug(dir(sql))
|
||||
log.debug('*** ** * ** ***')
|
||||
|
||||
if not db:
|
||||
log.exception('The database connection is not available!!! Returning False.')
|
||||
return False
|
||||
|
||||
try:
|
||||
# https://docs.sqlalchemy.org/en/13/core/tutorial.html#using-textual-sql
|
||||
# https://docs.sqlalchemy.org/en/13/core/sqlelement.html#sqlalchemy.sql.expression.TextClause.columns
|
||||
|
||||
@@ -199,9 +199,9 @@ router = APIRouter()
|
||||
@router.get('/{obj_type_l1}/{obj_type_l2}/list')
|
||||
@router.get('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/list')
|
||||
async def get_obj_li(
|
||||
obj_type_l1: str = Query(..., min_length=2, max_length=50),
|
||||
obj_type_l2: str = Query(None, min_length=2, max_length=50),
|
||||
obj_type_l3: str = Query(None, min_length=2, max_length=50),
|
||||
obj_type_l1: str,
|
||||
obj_type_l2: str = None,
|
||||
obj_type_l3: str = None,
|
||||
|
||||
for_obj_type: Optional[str] = Query(None, max_length=50),
|
||||
for_obj_id: Optional[str] = Query(None, max_length=22),
|
||||
@@ -621,10 +621,10 @@ async def get_obj(
|
||||
@router.patch('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/{obj_id}')
|
||||
async def patch_obj(
|
||||
crud: Api_Crud_Base,
|
||||
obj_type_l1: Optional[str] = Query(..., max_length=50),
|
||||
obj_type_l1: str,
|
||||
obj_id: str,
|
||||
obj_type_l2: str = None,
|
||||
obj_type_l3: str = None,
|
||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
|
||||
run_safety_check: bool = True,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user