mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-15 09:49:46 +00:00
get_total_unique_step_order_count_by_task_ids fix again (#1881)
This commit is contained in:
parent
2cef654a9a
commit
0b8f64e8ab
1 changed files with 4 additions and 4 deletions
|
@ -3,7 +3,7 @@ from datetime import datetime, timedelta
|
||||||
from typing import Any, List, Optional, Sequence
|
from typing import Any, List, Optional, Sequence
|
||||||
|
|
||||||
import structlog
|
import structlog
|
||||||
from sqlalchemy import and_, delete, distinct, func, select, update
|
from sqlalchemy import and_, delete, distinct, func, select, tuple_, update
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
||||||
|
|
||||||
|
@ -356,11 +356,11 @@ class AgentDB:
|
||||||
try:
|
try:
|
||||||
async with self.Session() as session:
|
async with self.Session() as session:
|
||||||
query = (
|
query = (
|
||||||
select(func.count(distinct(StepModel.task_id, StepModel.order)))
|
select(func.count(distinct(tuple_(StepModel.task_id, StepModel.order))))
|
||||||
.where(StepModel.task_id.in_(task_ids))
|
.where(StepModel.task_id.in_(task_ids))
|
||||||
.filter_by(organization_id=organization_id)
|
.where(StepModel.organization_id == organization_id)
|
||||||
)
|
)
|
||||||
return (await session.scalars(query)).scalar()
|
return (await session.execute(query)).scalar()
|
||||||
except SQLAlchemyError:
|
except SQLAlchemyError:
|
||||||
LOG.error("SQLAlchemyError", exc_info=True)
|
LOG.error("SQLAlchemyError", exc_info=True)
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue