-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
PRs (with tests!) welcomea fix or feature which is appropriate to be implemented by volunteersa fix or feature which is appropriate to be implemented by volunteersasynciopostgresqluse casenot really a feature or a bug; can be support for new DB features or user use cases not anticipatednot really a feature or a bug; can be support for new DB features or user use cases not anticipated
Milestone
Description
Hi!
I use sqlalchemy 1.4 with asyncpg driver with pgbouncer.
from sqlalchemy.ext.asyncio import create_async_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.asyncio import AsyncSession
engine = create_async_engine(
f'postgresql+asyncpg://{username}:{password}@{host}:{port}/{dbname}',
echo=False,
)
session_maker = sessionmaker(
engine,
class_=AsyncSession,
)
I have an error:
asyncpg.exceptions.DuplicatePreparedStatementError: prepared statement "__asyncpg_stmt_a__" already exists
HINT:
NOTE: pgbouncer with pool_mode set to "transaction" or
"statement" does not support prepared statements properly.
You have two options:
* if you are using pgbouncer for connection pooling to a
single server, switch to the connection pool functionality
provided by asyncpg, it is a much better option for this
purpose;
* if you have no option of avoiding the use of pgbouncer,
then you can set statement_cache_size to 0 when creating
the asyncpg connection object.
How i can pass this setting (statement_cache_size=0) to asyncpg connection object?
michael-leanix, hatala91, dhan, nikitagashkov, ToGoBananas and 11 more
Metadata
Metadata
Assignees
Labels
PRs (with tests!) welcomea fix or feature which is appropriate to be implemented by volunteersa fix or feature which is appropriate to be implemented by volunteersasynciopostgresqluse casenot really a feature or a bug; can be support for new DB features or user use cases not anticipatednot really a feature or a bug; can be support for new DB features or user use cases not anticipated