tortoise / tortoise/tortoise-orm
Last inserted row method
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Describe the solution you'd like
Having a clear method to get the last inserted row, useful when you want to use last inserted row at a place where you don't have access to the insertion return
Describe alternatives you've considered
The only alternatives right now are :
Table.all().order_by("-id").first() -> QuerySetSingle
Table.all().order_by("-id").limit(1) -> QuerySet
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 tracing the existing Table.all().order_by("-id").first() and limit(1) alternatives to understand the ORM entry points involved. Define the expected last-inserted-row behavior across the supported database backends, then verify that the new method returns the inserted row when the insertion result is not available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100