Repository navigation
Python: Prefer injected Postgres clients over connection settings - #9983
Open
ZedingZhang (ZedingZhang) wants to merge 1 commit into
Open
ZedingZhang (ZedingZhang) wants to merge 1 commit into
ZedingZhang (ZedingZhang) wants to merge 1 commit into
Conversation
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 2, 2026 17:44 — with
GitHub Actions
Inactive
ZedingZhang (ZedingZhang)
marked this pull request as ready for review
November 2, 2026 17:45
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 2, 2026 17:45 — with
GitHub Actions
Inactive
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 2, 2026 17:46 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change to prioritize caller-supplied Postgres connections and pools.
No open issues 🎉
What changed in this PR
Updates the Python Postgres connector to prefer caller-supplied connections and pools over connection-string and .env settings, addressing #9958 while preserving caller ownership.
Changes:
- Removes the conflicting-settings rejection for injected clients.
- Expands regression coverage for settings bypass, schema handling, and client ownership; retains invalid-client rejection coverage.
- Updates README and constructor documentation to explain the new precedence.
| File | Description |
|---|---|
python/packages/postgres/tests/test_postgres.py |
Updates the invalid-client case to retain rejection coverage. |
python/packages/postgres/tests/test_postgres_settings.py |
Tests injected-client precedence and ownership across 32 combinations. |
python/packages/postgres/README.md |
Documents that injected clients override connection settings. |
python/packages/postgres/agent_framework_postgres/_vector_store.py |
Removes the conflict check and updates parameter descriptions. |
Review effort: Balanced
This branch was previously deployed
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.
Motivation & Context
PostgresStoreandPostgresCollectionraiseValueErrorwhen an injected Psycopg connection or pool is supplied alongside connection-string or.envoptions. The injected client's configuration should take precedence, allowing applications to reuse their client with shared configuration.Description & Review Guide
Related Issue
Fixes #9958. The issue has the
ready-for-implementationlabel; no competing open PR was found before submission.AI Assistance
AI assistance details: Codex assisted with investigation, implementation, regression tests, parameter documentation, and this PR description. Codex executed the reported checks; I reviewed all submitted content and take responsibility for it.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.