MagicStack / MagicStack/asyncpg
column reference X is ambiguous
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 468
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello everyone 👋
Migrating from psycopg2 to asyncpg, I'm facing an issue with an executemany.
Here is my example:
Table structure:
CREATE TABLE table_name
(
column1 text PRIMARY KEY,
...
column8 JSON,
column9 numeric,
column10 numeric,
...
);
SQL request:
sql = """
UPDATE table_name
SET column8 = data.column8, column9 = data.column9, column10 = data.column10
FROM unnest ($1::table_name[]) AS data(column1, column8, column9, column10)
WHERE table_name.column1 = data.column1"""
args = [("id_1", "json_string_1", None, None), ("id_2", "json_string_2", decimal("5"), decimal("8")), ...]
loop.run_until_complete(conn.executemany(sql, args))
The result of this request is column reference "column8" is ambiguous
I don't know if it's related (and I know this library isn't the same as psycopg2) but before I had to pass a template for this request (like so: template = "(%s, %s::json, %s::numeric, %s::numeric)")
- asyncpg version: v0.23.0
- PostgreSQL version: 13.3
- Do you use a PostgreSQL SaaS? No
- Python version: 3.8.9 (Pyenv)
- Platform: Debian buster (Docker)
- Do you use pgbouncer?: No
- Did you install asyncpg with pip?: Yes
- If you built asyncpg locally, which version of Cython did you use?: No
- Can the issue be reproduced under both asyncio and
uvloop?: 🤷♂️
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用所述的版本和参数复现所提供的 PostgreSQL UPDATE 和 asyncpg executemany 示例。将数据库错误与 asyncpg 文档中说明的 executemany 行为进行比较,以确定是否请求对库进行更改;完成的标准是确认 asyncpg 存在缺陷,或明确 SQL 必须由用户更改。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- postgresql, python
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 20/100