Skip to content

Proposal: Add support for asyncpg adapter unique name generator #9608

@teror4uks

Description

@teror4uks

Describe the use case

The issue: #6467 describes the problem with unique naming prepared statements on asyncpg side when using pg bouncer.

To avoid this the asyncpg added an optional name parameter to provide a custom name for prepared statements MagicStack/asyncpg#846.

I suggest populating an optional custom function to generate unique names for prepared statements in Asyncpg Adapter

Databases / Backends / Drivers targeted

Postgresql, asyncpg

Example Use

from uuid import uuid4

engine = create_async_engine(...,     
    connect_args={
        'prepared_statement_name_func': lambda:  f'__asyncpg_{uuid4()}__',
    },
)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    postgresqluse casenot really a feature or a bug; can be support for new DB features or user use cases not anticipated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions