Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix use normal prisma

Ishaan Jaff6f06da7d4667
diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py
index f16e604f661..d1d17d0ef5d 100644
--- a/litellm/proxy/utils.py
+++ b/litellm/proxy/utils.py
@@ -832,17 +832,17 @@ class PrismaClient:
dname = os.path.dirname(abspath)
os.chdir(dname)
- # try:
- # subprocess.run(["prisma", "generate"])
- # subprocess.run(
- # ["prisma", "db", "push", "--accept-data-loss"]
- # ) # this looks like a weird edge case when prisma just wont start on render. we need to have the --accept-data-loss
- # except Exception as e:
- # raise Exception(
- # f"Unable to run prisma commands. Run `pip install prisma` Got Exception: {(str(e))}"
- # )
- # finally:
- # os.chdir(original_dir)
+ try:
+ subprocess.run(["prisma", "generate"])
+ subprocess.run(
+ ["prisma", "db", "push", "--accept-data-loss"]
+ ) # this looks like a weird edge case when prisma just wont start on render. we need to have the --accept-data-loss
+ except Exception as e:
+ raise Exception(
+ f"Unable to run prisma commands. Run `pip install prisma` Got Exception: {(str(e))}"
+ )
+ finally:
+ os.chdir(original_dir)
# Now you can import the Prisma Client
from prisma import Prisma # type: ignore
verbose_proxy_logger.debug("Connecting Prisma Client to DB..")
diff --git a/set_prisma_permissions.py b/set_prisma_permissions.py
deleted file mode 100644
index 0973b90b885..00000000000
--- a/set_prisma_permissions.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import os
-import importlib
-from pathlib import Path
-
-
-# Get the location of the 'prisma' package
-package_name = "prisma"
-spec = importlib.util.find_spec(package_name)
-print("spec = ", spec) # noqa
-
-if spec and spec.origin:
- print("spec origin= ", spec.origin) # noqa
- _base_prisma_package_dir = os.path.dirname(spec.origin)
- print("base prisma package dir = ", _base_prisma_package_dir) # noqa
-else:
- raise ImportError(f"Package {package_name} not found.")
-
-
-def ensure_prisma_has_writable_dirs(path: str | Path) -> None:
- import stat
-
- for root, dirs, _ in os.walk(path):
- for directory in dirs:
- dir_path = os.path.join(root, directory)
- os.makedirs(dir_path, exist_ok=True)
- print("making dir for prisma = ", dir_path)
- os.chmod(dir_path, os.stat(dir_path).st_mode | stat.S_IWRITE | stat.S_IEXEC)
-
- # make this file writable - prisma/schema.prisma
- file_path = os.path.join(path, "schema.prisma")
- print("making file for prisma = ", file_path)
- # make entire directory writable
- os.chmod(path, os.stat(path).st_mode | stat.S_IWRITE | stat.S_IEXEC)
-
- os.chmod(file_path, os.stat(file_path).st_mode | stat.S_IWRITE | stat.S_IEXEC)
-
-
-# Use the package directory in your method call
-ensure_prisma_has_writable_dirs(path=_base_prisma_package_dir)