docs: fix README facts and examples - #63
Merged
Merged
Conversation
- Subclass DeclarativeBase in the retry example so it runs - Describe DB_RETRY_RETRIES_NUMBER and retries=N as total attempts - Transaction closes the session on exit - Failover happens only on a connect timeout - Drop unused imports from the multi-host example - Document target_session_attrs set by build_db_dsn - Sentence-case headings, plain feature list, less filler
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.
Summary
README fixes for facts that did not match the code, an example that did not run, and some prose cleanup. No code changes; pyproject
descriptionuntouched.Changes
class User(DeclarativeBase)raisesInvalidRequestError: Cannot use 'DeclarativeBase' directly. Addedclass Base(DeclarativeBase)andclass User(Base).DB_RETRY_RETRIES_NUMBERandretries=Nwere described as the number of retries.db_retry/retry.py:46usestenacity.stop_after_attempt(N), which counts the first call, so the default 3 means 2 retries (checked: a function always raisingSerializationErroris called 3 times). Now worded as total attempts.Transactionwas described as only rolling back.db_retry/transaction.py:22-24rolls back if still in a transaction, then always closes the session.db_retry/connections.py:88falls back host by host only when the first multi-host connect raisesTimeoutError; other errors propagate.sa,AsyncSession,DeclarativeBase,mapped_columnwithout using them; removed.build_db_dsnalso setstarget_session_attrstoread-write, orprefer-standbywithuse_replica=True(db_retry/dsn.py:26); documented.SerializationErrorandPostgresConnectionError(db_retry/retriable.py:5).Verification: byte-compiled every python block in the README; ran the retry, multi-host and serializable examples against a throwaway Postgres container (all succeed). The transaction example uses placeholder service modules and was only compiled.
Checklist
ruff)ty)uv build) if packaging or build config changeddescription, profile blurb) if this touches packaging