MagicStack / MagicStack/asyncpg
Best way to spread query over multipule asyncio tasks?
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 468
- PR 合并指标
- 30 天内没有已合并 PR
描述
I want to the data from a query as data for network actions. I am thinking about the best way to do this.
1> perform a single query and fetch all rows, then divide the result and pa sub part to each task
easy, but not good for large amount of data
2> Use a asyncio Queue. The producer would use a cursor to read that data and each task would be a consumer
difficult, do not know it would work.
3> Use pooled connections. but there would have to be a global "next".for each query
dumb idea
What would be the best and simplest way to query the database and do network actions and then use pooled connections to write a result?
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 没有指出需要检查的文件、测试或入口点。首先查看 asyncpg 关于查询、游标、连接池和事务的文档,然后定义一种受支持的模式,用于使用连接池连接消费查询行、执行网络操作并写入结果。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- postgresql, python
- 领域
- database
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 20/100