Class AbstractSessionPool (3.50.1)

AbstractSessionPool(labels=None, database_role=None)

Specifies required API for concrete session pool implementations.

Parameters

Name Description
labels dict (str -> str) or None

(Optional) user-assigned labels for sessions created by the pool.

database_role str

(Optional) user-assigned database_role for the session.

Properties

database_role

User-assigned database_role for sessions created by the pool.

Returns
Type Description
str database_role assigned by the user

labels

User-assigned labels for sessions created by the pool.

Returns
Type Description
dict (str -> str) labels assigned by the user

Methods

bind

bind(database)

Associate the pool with a database.

Parameter
Name Description
database Database

database used by the pool to create sessions when needed. Concrete implementations of this method may pre-fill the pool using the database.

Exceptions
Type Description
NotImplementedError abstract method

clear

clear()

Delete all sessions in the pool.

Concrete implementations of this method are allowed to raise an error to signal that the pool is full, or to block until it is not full.

Exceptions
Type Description
NotImplementedError abstract method

get

get()

Check a session out from the pool.

Concrete implementations of this method are allowed to raise an error to signal that the pool is exhausted, or to block until a session is available.

Exceptions
Type Description
NotImplementedError abstract method

put

put(session)

Return a session to the pool.

Parameter
Name Description
session Session

the session being returned. Concrete implementations of this method are allowed to raise an error to signal that the pool is full, or to block until it is not full.

Exceptions
Type Description
NotImplementedError abstract method

session

session(**kwargs)

Check out a session from the pool.

Returns
Type Description
SessionCheckout a checkout instance, to be used as a context manager for accessing the session and returning it to the pool.