feat:修改nl2sql功能
This commit is contained in:
+7
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user