Skip to content

Context manager for ConnectionPool#connection method #34

Closed
@Veritaris

Description

@Veritaris

ATM to use connection we need to write the following code:

connection_pool = psqlpy.ConnectionPool()
conn = await connection_pool.connection()
conn.execute("SELECT * from users")

But it would be more pythonic to use context manager here like:

connection_pool = psqlpy.ConnectionPool()
async with connection_pool.connection() as conn:
    conn.execute("SELECT * from users")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions