MagicStack / MagicStack/asyncpg
Large Object support
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 8.1k
- Fork
- 468
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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](https://www.psycopg.org/docs/extensions.html#psycopg2.extensions.lobject)?
Other suggestions most welcome.
Thanks!
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
La issue non indica file, test o punti di ingresso di asyncpg. Inizia esaminando il ciclo lo_get proposto e il riferimento collegato a psycopg2 lobject, quindi determina l'ambito dell'API e il comportamento di streaming che costituirebbero un supporto diretto per i large object.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- postgresql, python
- Ambito
- database
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100