mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix add fix to update spend logs
This commit is contained in:
parent
f7f4b9bee7
commit
df1ac92222
2 changed files with 31 additions and 0 deletions
|
@ -1920,6 +1920,34 @@ class PrismaClient:
|
|||
)
|
||||
raise e
|
||||
|
||||
async def apply_db_fixes(self):
|
||||
try:
|
||||
verbose_proxy_logger.debug(
|
||||
"Applying LiteLLM - DB Fixes fixing logs in SpendLogs"
|
||||
)
|
||||
sql_query = """
|
||||
UPDATE "LiteLLM_SpendLogs"
|
||||
SET team_id = (
|
||||
SELECT vt.team_id
|
||||
FROM "LiteLLM_VerificationToken" vt
|
||||
WHERE vt.token = "LiteLLM_SpendLogs".api_key
|
||||
)
|
||||
WHERE team_id IS NULL
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM "LiteLLM_VerificationToken" vt
|
||||
WHERE vt.token = "LiteLLM_SpendLogs".api_key
|
||||
);
|
||||
"""
|
||||
response = await self.db.query_raw(sql_query)
|
||||
verbose_proxy_logger.debug(
|
||||
"Applied LiteLLM - DB Fixes fixing logs in SpendLogs, Response=%s",
|
||||
response,
|
||||
)
|
||||
except Exception as e:
|
||||
verbose_proxy_logger.debug(f"Error apply_db_fixes: {str(e)}")
|
||||
return
|
||||
|
||||
|
||||
class DBClient:
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue