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,6 +247,13 @@ async def read_flows(
|
||||||
return compress_response(flows)
|
return compress_response(flows)
|
||||||
|
|
||||||
stmt = stmt.where(Flow.folder_id == folder_id)
|
stmt = stmt.where(Flow.folder_id == folder_id)
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.filterwarnings(
|
||||||
|
"ignore", category=DeprecationWarning, module=r"fastapi_pagination\.ext\.sqlalchemy"
|
||||||
|
)
|
||||||
return await apaginate(session, stmt, params=params)
|
return await apaginate(session, stmt, params=params)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,12 @@ async def get_transactions(
|
||||||
.where(TransactionTable.flow_id == flow_id)
|
.where(TransactionTable.flow_id == flow_id)
|
||||||
.order_by(col(TransactionTable.timestamp))
|
.order_by(col(TransactionTable.timestamp))
|
||||||
)
|
)
|
||||||
|
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)
|
return await apaginate(session, stmt, params=params, transformer=transform_transaction_table)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=500, detail=str(e)) from e
|
raise HTTPException(status_code=500, detail=str(e)) from e
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,12 @@ async def read_project(
|
||||||
stmt = stmt.where(Flow.is_component == False) # noqa: E712
|
stmt = stmt.where(Flow.is_component == False) # noqa: E712
|
||||||
if search:
|
if search:
|
||||||
stmt = stmt.where(Flow.name.like(f"%{search}%")) # type: ignore[attr-defined]
|
stmt = stmt.where(Flow.name.like(f"%{search}%")) # type: ignore[attr-defined]
|
||||||
|
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)
|
paginated_flows = await apaginate(session, stmt, params=params)
|
||||||
|
|
||||||
return FolderWithPaginatedFlows(folder=FolderRead.model_validate(project), flows=paginated_flows)
|
return FolderWithPaginatedFlows(folder=FolderRead.model_validate(project), flows=paginated_flows)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue