tortoise / tortoise/tortoise-orm
Data streaming (cursors)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Is your feature request related to a problem? Please describe.
I'm a recent user of Tortoise and just noticed the lack of cursors for lazy data streaming. This is a key feature since in some cases it's impractical to preload all the data and then iterate across it, as it may be huge. I'm not sure whether aiosqlite or aiomysql implement cursors, but asyncpg has those and they are pretty handy.
Describe the solution you'd like
It would be nice if async for could use a cursor instead of preloading all data, and maybe also expose a cursor method that would return an iterator, which one could then close manually later on.
Describe alternatives you've considered
I have not.
Additional context
I've talked with Nickolas via Gitter and he suggested I opened this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the ORM's existing async-for query path and the cursor capabilities of the SQLite, MySQL, and PostgreSQL drivers mentioned in the issue. Define whether async iteration should stream rows and whether a manually closable cursor API is required, then validate the behavior across those backends.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, postgresql, python, sqlite
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100