Module pglift.postgresql exposes the following API to manipulate a PostgreSQL cluster:

pglift.postgresql.status(instance: BaseInstance) Status#

Return the status of an instance.

pglift.postgresql.check_status(instance: BaseInstance, expected: Status) None#

Check actual instance status with respected to expected one.


InstanceStateError – in case the actual status is not expected.

pglift.postgresql.is_ready(instance: PostgreSQLInstance) bool#

Return True if the instance is ready per pg_isready.

pglift.postgresql.logs(instance: PostgreSQLInstance, *, timeout: float | None = None, poll_interval: float = 0.1) Iterator[str]#

Return the content of current log file as an iterator.

pglift.postgresql.replication_lag(instance: PostgreSQLInstance) Decimal | None#

Return the replication lag of a standby instance.

The instance must be running; if the primary is not running, None is returned.


TypeError – if the instance is not a standby.