Merge pull request #4785 from jxxghp/cursor/fix-postgresql-textual-sql-expression-error-e023

This commit is contained in:
jxxghp
2025-08-20 20:13:56 +08:00
committed by GitHub

View File

@@ -4,6 +4,7 @@ from app.core.config import settings
from app.db import SessionFactory
from app.modules import _ModuleBase
from app.schemas.types import ModuleType, OtherModulesType
from sqlalchemy import text
class PostgreSQLModule(_ModuleBase):
@@ -54,7 +55,7 @@ class PostgreSQLModule(_ModuleBase):
# 测试数据库连接
db = SessionFactory()
try:
db.execute("SELECT 1")
db.execute(text("SELECT 1"))
except Exception as e:
return False, f"PostgreSQL连接失败{e}"
finally: