forked from phoenix/litellm-mirror
* fix(proxy_server.py): remove spendlog fixes from proxy startup logic Moves https://github.com/BerriAI/litellm/pull/4794 to `/db_scripts` and cleans up some caching-related debug info (easier to trace debug logs) * fix(langfuse_endpoints.py): Fixes https://github.com/BerriAI/litellm/issues/6041 * fix(azure.py): fix health checks for azure audio transcription models Fixes https://github.com/BerriAI/litellm/issues/5999 * Feat: Add Literal AI Integration (#5653) * feat: add Literal AI integration * update readme * Update README.md * fix: address comments * fix: remove literalai sdk * fix: use HTTPHandler * chore: add test * fix: add asyncio lock * fix(literal_ai.py): fix linting errors * fix(literal_ai.py): fix linting errors * refactor: cleanup --------- Co-authored-by: Willy Douhard <willy.douhard@gmail.com>
27 lines
797 B
Python
27 lines
797 B
Python
from prisma import Prisma
|
|
|
|
|
|
async def apply_db_fixes(db: Prisma):
|
|
try:
|
|
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 db.query_raw(sql_query)
|
|
print(
|
|
"Updated unassigned teams, Response=%s",
|
|
response,
|
|
)
|
|
except Exception as e:
|
|
raise Exception(f"Error apply_db_fixes: {str(e)}")
|
|
return
|