Repository navigation
Docs: a Transactions page, with tests that pin each statement first - #279
Merged
Merged
Conversation
…refs #267) Row 2 of the 26.11.1 docs audit. tests/test_transactions_behavior.py pins commit, rollback, the context manager, an exception in it, a failed statement inside a transaction, a second begin, visibility before the commit, set_auto_transaction, the run_in_transaction defaults and the GraphBatch refusal. how-to/transactions.adoc says only what those tests prove, and tests/test_docs_transactions_page.py runs every block of the page on both backends. Linked from the nav, the quickstart, databases-and-queries, concurrency and bulk-loads. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First slice of #267 (audit of the docs against 26.11.1), draft. It covers row 2, transactions, and records that row 1, single-pass results, was already done.
Tests first:
tests/test_transactions_behavior.pypins commit, rollback, the context manager, an exception inside it, a failed statement inside a transaction (the 26.11.1 undo), a secondbegin(), what the transaction and another thread see before the commit,set_auto_transaction, therun_in_transactiondefaults and theGraphBatchrefusal. The new pagehow-to/transactions.adocsays only what those tests prove, andtests/test_docs_transactions_page.pyruns every Python block of the page on both backends, in the pattern of the vectors page. The page is in the nav and linked from the quickstart, Databases and queries, Concurrency and Bulk loads (an explicit[[threads]]anchor was added to Concurrency for the link). It follows the DSL-first rule (statements throughdb.commandanddb.query) and links the main manual for what the engine guarantees.I could not run the tests on the laptop (CI runs them), so every assertion comes from reading the engine source (
LocalDatabase.begin/commit/rollback,TransactionContextstatement savepoints, the engine's ownIssue10194test) and the bindings code. If a test fails in CI, the page statement it backs is wrong and gets fixed here.Behavior worth a look, none of it filed:
with db.transaction(): ...; db.commit()raisesArcadeDBError("Transaction not begun") at the end of the block, because the context manager commits again. The rows of the first commit stay.db.rollback()with no active transaction raises nothing, whiledb.commit()with none raises.begin()opens a nested transaction that is independent of the outer one: it does not see the outer's uncommitted rows, and its commit is durable even if the outer one rolls back.with db.transaction()inside anotherwithdoes the same, so nesting is not a savepoint.arcadedb.txStatementSavepointMaxEntriesis stated from the engine's setting description and is not covered by a test here.Left of #267: rows 3 (types and datetimes), 4 (import and export), 5 (DataFrame, Arrow and columns), 8 (Python functions and events), 9 (record objects), 10 (
set_wal_flush,fileSync,txWalGroupCommit), 11 (AsyncExecutor) and 12 (theSchemaAPI line). Rows 6, 7 and 13 and the stale statements were planned for #264 (merged) and #276; I did not re-check them againstmainhere, so that is still to confirm. Row 1 I did check: the section "A result set is read once" is on Databases and queries since #264, andtests/test_resultset.pyalready pins it.Refs #267
🤖 Generated with Claude Code