tortoise / tortoise/tortoise-orm
Selecting schema not worked with pgbouncer
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Describe the bug
Get error from asyncpg when set custom schema in connection credentials:
asyncpg.exceptions.ProtocolViolationError: unsupported startup parameter: search_path
To Reproduce
CREATE SCHEMA IF NOT EXISTS notpublic
await Tortoise.init(
{
"connections": {
__name__: {
"engine": "tortoise.backends.asyncpg",
"credentials": {
**credentials,
"schema": "notpublic"
}
}
},
"apps": {"models": {"models": [__name__], "default_connection": __name__}},
},
)
Expected behavior
Successfully init
Additional context
Support schema added in https://github.com/tortoise/tortoise-orm/pull/172 and changed in https://github.com/tortoise/tortoise-orm/pull/229
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Tortoise.init configuration with asyncpg, the custom schema credential, and PgBouncer, then trace how the schema becomes the PostgreSQL startup parameter. Confirm the fix by successfully initializing through PgBouncer and adding regression coverage for this configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100