feat:修改nl2sql功能

This commit is contained in:
2026-09-14 10:57:48 +08:00
parent a7f9e182a4
commit 67d5cfc2b8
15 changed files with 206 additions and 54 deletions
+7 -1
View File
@@ -27,6 +27,7 @@ async def execute_readonly_sql(
masks: dict[tuple[str, str], str] | None = None,
max_rows: int | None = None,
timeout_seconds: float | None = None,
parameters: dict[str, object] | None = None,
user_id: int = 0,
connection_id: int | None = None,
kill_query=None,
@@ -49,7 +50,12 @@ async def execute_readonly_sql(
connection_id=connection_id,
)
try:
execution = session.execute(text(validated_sql.sql))
statement = text(validated_sql.sql)
execution = (
session.execute(statement, parameters)
if parameters
else session.execute(statement)
)
result = (
await asyncio.wait_for(execution, timeout_seconds)
if timeout_seconds is not None