fix: return end user top spend

This commit is contained in:
Krrish Dholakia 2024-02-29 19:11:50 -08:00
parent 1788c894f2
commit 7cfcaa9556
2 changed files with 80 additions and 44 deletions

View file

@ -601,7 +601,7 @@ class PrismaClient:
except Exception as e:
sql_query = """
CREATE VIEW "Last30dTopEndUsersSpend" AS
SELECT end_user, SUM(spend) AS total_spend
SELECT end_user, COUNT(*) AS total_events, SUM(spend) AS total_spend
FROM "LiteLLM_SpendLogs"
WHERE end_user <> '' AND end_user <> user
AND "startTime" >= CURRENT_DATE - INTERVAL '30 days'