-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[Durable Objects] Document transaction API changes with SQLite. #17698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 files reviewed, 1 total issue(s) found.
Deploying cloudflare-docs with
|
| Latest commit: |
7ebe21f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c47a2558.cloudflare-docs-7ou.pages.dev |
| Branch Preview URL: | https://kenton-transactions-with-sql.cloudflare-docs-7ou.pages.dev |
2e3ebd4 to
2fcdc88
Compare
|
Files with changes (up to 15)
|
d767663 to
50a6805
Compare
These existing links were just broken. Though, arguably they should actually go to `/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend`, perhaps? For now I just fixed the links.
ada952b to
7ebe21f
Compare
| * When using [the SQLite-backed storage engine](/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend), the `txn` object is obsolete. Any storage operations performed directly on the `ctx.storage` object, including SQL queries using [`ctx.storage.sql.exec()`](#sqlexec), will be considered part of the transaction. | ||
|
|
||
| ### transactionSync | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a working example for reference?
f825f3c to
3718c36
Compare
|
I added an example but in retrospect it's a bad example because as written it doesn't actually need transactionSync(): we automatically guarantee atomicity of queries performed with no await in between. I need a different example where the thrown exception actually rolls something back. That's the part you can only do with transactionSync(). |
3718c36 to
7ebe21f
Compare
|
I reverted the example, so this is back to what was reviewed and approved previously. I'm just going to merge this as-is without an example rather than let it be delayed further. |
|
For the record this was my example: 3718c36 But again, it's a bad example because it doesn't actually benefit from the use of |
* [Durable Objects] Document transaction API changes with SQLite. * [Durable Objects] Fix broken links to SQLite class creation docs. These existing links were just broken. Though, arguably they should actually go to `/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend`, perhaps? For now I just fixed the links.
Document that:
storage.transaction()API applies to SQL queries.storage.transactionSync()for synchronous transactions.