From 5065e9d16ec3dd852bb07a08dd820c1fa539a548 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 10 Nov 2026 17:35:54 -0800 Subject: [PATCH] fix(proxy): add execute_raw to the PrismaBatch protocol Prerequisite for the #50298 backport to lts/1.108.x, which queues guarded raw spend resets on the batch. Hand-ported from 24a7bf6af728272eca2ba3277a2f3cdfa7e60863 (#48260, main). --- litellm/repositories/prisma_protocols.py | 2 ++ tests/unit/repositories/test_unit_of_work.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/litellm/repositories/prisma_protocols.py b/litellm/repositories/prisma_protocols.py index c42301a9316..63cfcbc7b45 100644 --- a/litellm/repositories/prisma_protocols.py +++ b/litellm/repositories/prisma_protocols.py @@ -171,4 +171,6 @@ class PrismaBatch(Protocol): @property def litellm_projecttable(self) -> BatchTable: ... + def execute_raw(self, query: str, *args: object) -> None: ... + async def commit(self) -> None: ... diff --git a/tests/unit/repositories/test_unit_of_work.py b/tests/unit/repositories/test_unit_of_work.py index 96e66041366..141684c7757 100644 --- a/tests/unit/repositories/test_unit_of_work.py +++ b/tests/unit/repositories/test_unit_of_work.py @@ -39,6 +39,9 @@ class FakeBatch: self.litellm_projecttable = FakeBatchTable("litellm_projecttable", self.calls) self.litellm_endusertable = FakeBatchTable("litellm_endusertable", self.calls) + def execute_raw(self, query: str, *args: object) -> None: + self.calls.append(("execute_raw", {"query": query}, {"args": args})) + async def commit(self) -> None: self.commit_count += 1