mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
fix(proxy): use parameterized query for combined_view token lookup
This commit is contained in:
parent
3a6db708ce
commit
4dc416ee74
1 changed files with 5 additions and 5 deletions
|
|
@ -2645,7 +2645,7 @@ class PrismaClient:
|
|||
raise e
|
||||
|
||||
async def _query_first_with_cached_plan_fallback(
|
||||
self, sql_query: str
|
||||
self, sql_query: str, *args
|
||||
) -> Optional[dict]:
|
||||
"""
|
||||
Execute a query with automatic fallback for PostgreSQL cached plan errors.
|
||||
|
|
@ -2664,7 +2664,7 @@ class PrismaClient:
|
|||
Original exception if not a cached plan error
|
||||
"""
|
||||
try:
|
||||
return await self.db.query_first(query=sql_query)
|
||||
return await self.db.query_first(sql_query, *args)
|
||||
except Exception as e:
|
||||
error_str = str(e)
|
||||
if "cached plan must not change result type" in error_str:
|
||||
|
|
@ -2679,7 +2679,7 @@ class PrismaClient:
|
|||
"retrying with fresh plan. This may occur during rolling deployments "
|
||||
"when schema changes are applied."
|
||||
)
|
||||
return await self.db.query_first(query=sql_query_retry)
|
||||
return await self.db.query_first(sql_query_retry, *args)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
|
@ -3016,11 +3016,11 @@ class PrismaClient:
|
|||
LEFT JOIN "LiteLLM_ProjectTable" AS p ON v.project_id = p.project_id
|
||||
LEFT JOIN "LiteLLM_OrganizationTable" AS o ON v.organization_id = o.organization_id
|
||||
LEFT JOIN "LiteLLM_BudgetTable" AS b2 ON o.budget_id = b2.budget_id
|
||||
WHERE v.token = '{token}'
|
||||
WHERE v.token = $1
|
||||
"""
|
||||
|
||||
response = await self._query_first_with_cached_plan_fallback(
|
||||
sql_query
|
||||
sql_query, hashed_token
|
||||
)
|
||||
|
||||
# If not found in main table, check deprecated keys (grace period)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue