You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "zzzzwc (via GitHub)" <gi...@apache.org> on 2025/12/24 03:12:29 UTC
[I] llm生成USE xxx;SELECT XXX时, execute_query tools无法返回数据 [doris-mcp-server]
zzzzwc opened a new issue, #71:
URL: https://github.com/apache/doris-mcp-server/issues/71
首先发现了
db.py
```python
# Check if it's a query statement (statement that returns result set)
# FIX for Issue #62 Bug 5: Added WITH support for Common Table Expressions (CTE)
sql_upper = sql.strip().upper()
if (sql_upper.startswith("SELECT") or
sql_upper.startswith("SHOW") or
sql_upper.startswith("DESCRIBE") or
sql_upper.startswith("DESC") or
sql_upper.startswith("EXPLAIN") or
sql_upper.startswith("WITH")): # FIX: Support CTE queries
data = await cursor.fetchall()
row_count = len(data)
else:
data = []
row_count = cursor.rowcount
```
这里没有考虑到USE开头的语句,但是把这里的判断去掉后,发现仍然没法返回数据。
调研后发现根因是aiomysql和pymysql行为不太一样
aiomysql cursor.execute多条语句之后, cursor状态受首条语句影响
pymysql cursor.execute多条语句之后, cursor状态受最后一条语句影响
这导致了execute USE xxx;SELECT XXX;时cursor fetch的结果集是USE xxxx;的空结果集。
然后我改了prompt让llm尽量不生成USE xxx;
但有时候llm又会生成SELECT xxx;SELECT xxx;只能再调prompt;
再加上看测试和已有代码里,mcp是想要支持多语句execute_sql的;我就把他实现了一下:
https://github.com/apache/doris-mcp-server/pull/70
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [I] llm生成USE xxx;SELECT XXX时, execute_query tools无法返回数据 [doris-mcp-server]
Posted by "FreeOnePlus (via GitHub)" <gi...@apache.org>.
FreeOnePlus commented on issue #71:
URL: https://github.com/apache/doris-mcp-server/issues/71#issuecomment-3688666663
close #70
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [I] llm生成USE xxx;SELECT XXX时, execute_query tools无法返回数据 [doris-mcp-server]
Posted by "FreeOnePlus (via GitHub)" <gi...@apache.org>.
FreeOnePlus closed issue #71: llm生成USE xxx;SELECT XXX时, execute_query tools无法返回数据
URL: https://github.com/apache/doris-mcp-server/issues/71
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org