MagicStack / MagicStack/asyncpg

Large Object support

オープン
#826 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
8.1k
フォーク
468
PR マージ指標
30日以内にマージされた PR はありません

説明

Are there any plans to have direct support for large objects for efficient streaming of data?

My use case: my webapp supports uploads of binary data files. These files are stored with TOAST (bytea) which is fine: these files are not directly downloaded via the app, and even if they were, we're talking 10s of MB, so I'm not worried about memory footprint for an individual record. HOWEVER, part of the requirements for this app is that all these files can be downloaded in a single zip file. This can be 100s of MBs. My plan: kickoff a background task that builds the zip file, then stores the zip file in PG as a large object. The question then is: providing an efficient download via my webapp (aiohttp).

I could stream it with a loop around, e.g.:

SELECT lo_get(data_oid, :offset, :chunksize) from zipstorage where id = :id

where chunksize might be 1MB and offset increases by 1MB with each iteration, stopping the iteration when the returned data is < 1MB.

Might there be a more direct, efficient way? E.g., as with psycopg2's lobject?

Other suggestions most welcome.

Thanks!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

この issue では asyncpg のファイル、テスト、エントリーポイントが指定されていません。まず提案されている lo_get ループとリンク先の psycopg2 lobject リファレンスを確認し、次に直接的なラージオブジェクト対応と見なせる API の範囲とストリーミング動作を判断してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
postgresql, python
領域
database
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。