Skip to content

Module

pgstats.models

pgstats.models.IndexStats

Bases: Model

For storing snapshots of postgres index stats

pgstats.models.JSONField

Bases: JSONField

Creates a consistent import path for JSONField regardless of Django version.

pgstats.models.TableStats

Bases: Model

For storing snapshots of postgres table stats

pgstats.models.dict_fetchall

dict_fetchall(cursor)

Returns all rows from a cursor as a dict

Source code in pgstats/models.py
def dict_fetchall(cursor):
    """Returns all rows from a cursor as a dict"""
    desc = cursor.description
    return [dict(zip((col[0] for col in desc), row)) for row in cursor.fetchall()]