fix: replace raw SQL with Prisma calls in admin user info endpoint#23230
Draft
CAFxX wants to merge 1 commit intoBerriAI:mainfrom
Draft
fix: replace raw SQL with Prisma calls in admin user info endpoint#23230CAFxX wants to merge 1 commit intoBerriAI:mainfrom
CAFxX wants to merge 1 commit intoBerriAI:mainfrom
Conversation
The admin dashboard's /user/info endpoint used raw SQL with json_agg to fetch all teams and keys in a single query. On large tables this takes 15s+ because PostgreSQL must serialize entire tables into JSON blobs. Replace with two concurrent Prisma find_many calls via asyncio.gather, which avoids json_agg overhead and follows the project's no-raw-SQL guideline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
json_aggquery in_get_user_info_for_proxy_adminwith two concurrent Prismafind_manycalls viaasyncio.gatherLiteLLM_TeamTableandLiteLLM_VerificationTokentables into JSON blobs server-side, taking 15s+ on large deploymentsjson_aggoverhead, return typed objects directly (no manual dict-to-model casting), and follow the project's no-raw-SQL guidelineRelated: #23196 (DB performance guidelines), #23136, #23152
Test plan
test_get_user_info_for_proxy_admin_uses_prismaverifying:find_manyis called (notquery_raw)litellm-dashboardkeys are filtered out🤖 Generated with Claude Code