MagicStack / MagicStack/asyncpg
Large Object support
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 8.1k
- Forks
- 468
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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!
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
El issue no menciona archivos, pruebas ni puntos de entrada de asyncpg. Empieza revisando el bucle lo_get propuesto y la referencia vinculada de psycopg2 lobject; después determina el alcance de la API y el comportamiento de streaming que contarían como soporte directo de objetos grandes.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- postgresql, python
- Área
- database
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100