MagicStack / MagicStack/asyncpg

Late/optional decoding?

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

还没有人认领这个 Issue。

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

描述

I have a few interrelated questions. Some might even be blasphemous for lack of in-depth knowledge of the wire protocol on my part.

1. Is there a way to delay decoding results until actually looking at data and interpreting it would become necessary?
2. Similarly, would it be possible to take undecoded "records" (not in the strict field-to-value map sense of asyncpg records) and pass them as-is to an upsert without having to re-encode them, so long as the bound arguments correspond to those returned by the previous query?
3. Would that potentially avoid the need to issue type introspection queries?
4. If not as of today, would this become easier once @vmarkovtsev's `asyncpg-rkt` fork gets merged back upstream?
5. Otherwise, at the very least, would it be possible to decode timestamps to something closer to their internal postgres representation - for example mapping them to the Python's `decimal` type? I personally find that python's `datetime` is terrible and Postgres timestamps can fall outside of the range that can be represented via `datetime`. Should such a decimal codec come with `asyncpg`, or should everyone write their own if and only if they think they need it?

Thank you & happy new year!

贡献指南

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

从这里开始

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

调研方向

未指定任何文件、测试或入口点。首先跟踪 asyncpg 的解码、类型自省、record 转发和 timestamp codec 路径,然后确定这些请求是否可以独立限定范围;要视为完成,需要有经维护者批准的设计,或范围明确界定的实现计划。

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

评估

技术栈
postgresql, python
领域
backend, databases
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
20/100

把新 issue 发到你的邮箱

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