Sqlite: Packages need a safe way to compose transactions without nested transaction errors
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13
- Forks
- 6
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 3
Description
I'm writing some package code for the still unreleased Sqlite module, and am running into an issue with package design. I want to have some of the functions wrap multiple SQLite calls in a transaction. Which I can using the current API! However, the problem is SQLite will error if you run a transaction within another transaction. This is not ideal for writing code meant to be published and used by others.
I'm forced to choose between two not-so-great options:
- Use transactions and document that errors might happen if the caller wraps them in another transaction.
- Don't use transactions and, via documentation, highly encouraging users to wrap them in their own transaction.
Either option is not really a great experience for users.
Ideally, there would be some way for a given database to know it's in a transaction and just skip running the transaction SQL if it's already is. I'm not sure how this would be done, if it's even possible, or if it's at all a desirable bit of functionality. But I wanted to open the issue to point to the problem and see if anything could be done about it!
Contributor guide
No contributing guide indexed for this repository
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 current transaction API in the unreleased Sqlite module and the linked SQLite transaction documentation. Determine how transaction state is represented and whether package functions can safely compose with caller-managed transactions. Done requires an agreed behavior and API for avoiding nested transaction errors, along with tests or documentation covering both wrapped and unwrapped calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100