fix: suppresses fastapi-pagination warnings (#8121)
* Suppresses fastapi-pagination warnings * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Deon Sanchez <69873175+deon-sanchez@users.noreply.github.com>
This commit is contained in:
parent
cddf2e13f0
commit
5e1b74d43f
3 changed files with 22 additions and 3 deletions
|
|
@ -247,7 +247,14 @@ async def read_flows(
|
|||
return compress_response(flows)
|
||||
|
||||
stmt = stmt.where(Flow.folder_id == folder_id)
|
||||
return await apaginate(session, stmt, params=params)
|
||||
|
||||
import warnings
|
||||
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings(
|
||||
"ignore", category=DeprecationWarning, module=r"fastapi_pagination\.ext\.sqlalchemy"
|
||||
)
|
||||
return await apaginate(session, stmt, params=params)
|
||||
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e)) from e
|
||||
|
|
|
|||
|
|
@ -171,6 +171,12 @@ async def get_transactions(
|
|||
.where(TransactionTable.flow_id == flow_id)
|
||||
.order_by(col(TransactionTable.timestamp))
|
||||
)
|
||||
return await apaginate(session, stmt, params=params, transformer=transform_transaction_table)
|
||||
import warnings
|
||||
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings(
|
||||
"ignore", category=DeprecationWarning, module=r"fastapi_pagination\.ext\.sqlalchemy"
|
||||
)
|
||||
return await apaginate(session, stmt, params=params, transformer=transform_transaction_table)
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e)) from e
|
||||
|
|
|
|||
|
|
@ -152,7 +152,13 @@ async def read_project(
|
|||
stmt = stmt.where(Flow.is_component == False) # noqa: E712
|
||||
if search:
|
||||
stmt = stmt.where(Flow.name.like(f"%{search}%")) # type: ignore[attr-defined]
|
||||
paginated_flows = await apaginate(session, stmt, params=params)
|
||||
import warnings
|
||||
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings(
|
||||
"ignore", category=DeprecationWarning, module=r"fastapi_pagination\.ext\.sqlalchemy"
|
||||
)
|
||||
paginated_flows = await apaginate(session, stmt, params=params)
|
||||
|
||||
return FolderWithPaginatedFlows(folder=FolderRead.model_validate(project), flows=paginated_flows)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue