MagicStack / MagicStack/asyncpg
Large Object support
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 8.1k
- Forks
- 468
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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!
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Das Issue nennt keine asyncpg-Dateien, Tests oder Einstiegspunkte. Beginne damit, die vorgeschlagene lo_get-Schleife und die verknüpfte psycopg2 lobject-Referenz zu überprüfen, und bestimme dann den API-Umfang und das Streaming-Verhalten, die als direkte Unterstützung großer Objekte gelten würden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- postgresql, python
- Bereich
- database
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100