# mayim.sql.postgres.interface

# Table of Contents

# PostgresPool

class PostgresPool(BaseInterface)

[view_source] (opens new window)

Interface for connecting to a Postgres database

Parents: BaseInterface

# close

async def close()

[view_source] (opens new window)

Close connections to the pool

# connection

@asynccontextmanager
async def connection(
        timeout: Optional[float] = None) -> AsyncIterator[AsyncConnection]

[view_source] (opens new window)

Obtain a connection to the database

Arguments:

  • timeout float, optional - Time before an error is raised on failure to connect. Defaults to None.

Returns:

  • AsyncIterator[Connection] - Iterator that will yield a connection

Yields:

  • Iterator[AsyncIterator[Connection]] - A database connection

# open

async def open()

[view_source] (opens new window)

Open connections to the pool

# scheme

Default: "postgres"