Skip to content

docs: fix README facts and examples - #63

Merged
lesnik512 merged 1 commit into
mainfrom
docs/fix-facts
Oct 3, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
docs/fix-facts

Conversation

@lesnik512

Copy link
Copy Markdown
Member

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 description untouched.

Changes

  • Retry example: class User(DeclarativeBase) raises InvalidRequestError: Cannot use 'DeclarativeBase' directly. Added class Base(DeclarativeBase) and class User(Base).
  • DB_RETRY_RETRIES_NUMBER and retries=N were described as the number of retries. db_retry/retry.py:46 uses tenacity.stop_after_attempt(N), which counts the first call, so the default 3 means 2 retries (checked: a function always raising SerializationError is called 3 times). Now worded as total attempts.
  • Transaction was described as only rolling back. db_retry/transaction.py:22-24 rolls back if still in a transaction, then always closes the session.
  • "Engine will automatically try different hosts on failure" overstated failover. db_retry/connections.py:88 falls back host by host only when the first multi-host connect raises TimeoutError; other errors propagate.
  • Multi-host example imported sa, AsyncSession, DeclarativeBase, mapped_column without using them; removed.
  • build_db_dsn also sets target_session_attrs to read-write, or prefer-standby with use_replica=True (db_retry/dsn.py:26); documented.
  • Retry intro now names the retried errors: asyncpg SerializationError and PostgresConnectionError (db_retry/retriable.py:5).
  • Sentence-case headings, plain feature bullets, shorter intro, removed filler words.

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

  • Lint and format pass (ruff)
  • Type check passes (ty)
  • Tests pass and new behavior is covered
  • Build succeeds (uv build) if packaging or build config changed
  • Repo metadata stays consistent across the three surfaces (GitHub description, pyproject description, profile blurb) if this touches packaging

- 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
@lesnik512
lesnik512 merged commit e742cdc into main Oct 3, 2026
12 checks passed
@lesnik512
lesnik512 deleted the docs/fix-facts branch October 3, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant