refactor: migrate session.query to select API in core misc modules (#34608)

This commit is contained in:
Renzo
2026-04-07 04:08:34 +00:00
committed by GitHub
parent 2f9667de76
commit b55bef4438
10 changed files with 26 additions and 56 deletions
+4 -2
View File
@@ -56,8 +56,10 @@ class BaseTraceInstance(ABC):
if not service_account:
raise ValueError(f"Creator account with id {app.created_by} not found for app {app_id}")
current_tenant = (
session.query(TenantAccountJoin).filter_by(account_id=service_account.id, current=True).first()
current_tenant = session.scalar(
select(TenantAccountJoin)
.where(TenantAccountJoin.account_id == service_account.id, TenantAccountJoin.current.is_(True))
.limit(1)
)
if not current_tenant:
raise ValueError(f"Current tenant not found for account {service_account.id}")