MagicStack / MagicStack/asyncpg

Cursor cannot be used with externally-managed transaction

未关闭
#1,311 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
8.1k
派生
468
PR 合并指标
30 天内没有已合并 PR

描述

Asyncpg 0.31.0, installed from pip and running against a local pg database. This is not a deployment issue, but rather an issue w/the check performed by Cursor._check_ready().

https://github.com/MagicStack/asyncpg/blob/db8ecc2a38e16fb0c090aef6f5506547c2831c24/asyncpg/cursor.py#L114-L116

Working on implementing streaming results for Peewee and I'm running into an issue w/the Cursor _check_ready(). Currently it requires an asyncpg-managed transaction in order to proceed. Is there a reason it doesn't do a similar check to the one here, where it queries is_in_transaction()?

https://github.com/MagicStack/asyncpg/blob/db8ecc2a38e16fb0c090aef6f5506547c2831c24/asyncpg/connection.py#L1532

I'd like to be able to use server-side cursors with Peewee's library-managed transactions.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 asyncpg/cursor.py 中的 Cursor._check_ready() 开始,然后将其事务检查与 connection.py 中的 is_in_transaction() 进行比较。确定就绪状态是否能够识别外部管理的事务,同时不破坏 asyncpg 管理的游标;完成标准是服务器端游标能够与 Peewee 的库管理事务一起工作。

由索引模型根据 Issue 内容生成。

评估

技术栈
postgresql, python
领域
database
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。