MagicStack / MagicStack/asyncpg
In Record complex data coming as string
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 468
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
* **asyncpg version**: **0.20.1**
* **PostgreSQL version**: "version" (using select version()
**"PostgreSQL 12.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit"**
* **Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?**: **Using installed version on a GCP server not Saas**
* **Python version**: **3.8.2**
* **Platform**: **CentOS8**
* **Do you use pgbouncer?**: No
* **Did you install asyncpg with pip?**: Yes
* **If you built asyncpg locally, which version of Cython did you use?**: NA
* **Can the issue be reproduced under both asyncio and
[uvloop](https://github.com/magicstack/uvloop)?**: Yes
**Following is my asyncpg code for fetching data:**
```
conn = await asyncpg.connect(
user,
password,
database,
host,
port,
)
records = await conn.fetch(query)
values = [dict(record) for record in records]
return values
```
`record` result that is received contains a complex object in the form of string as follows:
`'Affinity':'{"Quantity" : 0, "Revenue" : 0, "Margin" : 0, "Adjustable_Quantity" : 0, "Adjustable_Revenue" : 0, "Adjustable_Margin" : 0}'`
Due to which there's extra parsing required to convert data from `string to object`. Is it possible to not get the data as string by default, like other adapters `psycopg2` provide. Please recommend a workaround otherwise this needs lots of code addition to parse each and every object. I would ideally expect caller to directly consume json objects instead of parse and consume
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
The issue provides no repository file or test; begin at the conn.fetch(query) call and the conversion through dict(record), using the shown JSON-like value as the reproduction case. Check how asyncpg returns this PostgreSQL value and determine the expected default result type. Done means the desired object behavior is specified and covered by a regression test.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- postgresql, python
- 領域
- databases
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100