MagicStack / MagicStack/asyncpg
passing a list\set as an argument failing
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 468
- PR 合并指标
- 30 天内没有已合并 PR
描述
- asyncpg version:19.0
- PostgreSQL version:12
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?:N\A - Python version:3.7.5
- Platform:Windows
- Do you use pgbouncer?:No
- Did you install asyncpg with pip?:Yes
- If you built asyncpg locally, which version of Cython did you use?:N\A
- Can the issue be reproduced under both asyncio and
uvloop?:
Similar to issue #94
I am trying to set up a query using ($1) and passing an argument. I am running into an issue when trying to pass a list of sets. Is there a way to format this query like the last example?
query = [(0,0), (1,1), (2,2)]
works: await conn.fetch('SELECT * FROM table WHERE (a, b) IN ((0,0), (1,1), (2,2))')
works: await conn.fetch('SELECT * FROM table WHERE (a, b) IN ' + str(tuple(query)))
fails: await conn.fetch('SELECT * FROM table WHERE (a, b) IN ($1)', '((0,0), (1,1), (2,2))')
fails: await conn.fetch('SELECT * FROM table WHERE (a, b) IN ($1)', str(tuple(query)))
works: await conn.fetch('INSERT INTO table (a, b, c, d) VALUES ($1, $2, $3, $4)', a, b, c, d)
Thank you
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从此 issue 中的复现示例开始,并将其与 issue #94 进行比较,重点关注 asyncpg 如何处理在 PostgreSQL 行值 IN 表达式中使用的参数。在所述的 Python、PostgreSQL 和 Windows 设置上复现可工作的查询和失败的查询;当已确定或记录受支持的行为和所需的参数形式时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- postgresql, python
- 领域
- database
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100