MagicStack / MagicStack/asyncpg
"Cannot insert multiple commands into prepared statement" issue while executing query with params
未关闭
还没有人认领这个 Issue。
question
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 468
- PR 合并指标
- 30 天内没有已合并 PR
描述
(python 3.5.1, asyncpg 0.5.4)
Consider the next code
import asyncpg
import asyncio
async def run():
con = await asyncpg.connect(user="coldmind", database="test")
await con.execute('SELECT ($1); SELECT 2;', 1)
asyncio.get_event_loop().run_until_complete(run())
The executing fails with asyncpg.exceptions.PostgresSyntaxError: cannot insert multiple commands into a prepared statement error, while the another example (without passing params to the query) works well with multiple commands:
import asyncpg
import asyncio
async def run():
con = await asyncpg.connect(user="coldmind", database="test")
await con.execute('SELECT 1; SELECT 2;')
asyncio.get_event_loop().run_until_complete(run())
Why is the first example using a prepared statement instead of executing it?
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 con.execute 入口点开始,运行 issue 中的两个 Python 示例,以比较参数化查询和非参数化查询。跟踪参数如何影响执行,然后确定多个命令的预期行为,并记录或测试由此得出的决定。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- postgresql, python
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100