PivotMyTable is a PL/Python PosgreSQL function for easy construction of pivot tables, generating the proper code for the crosstab functions from the PostgreSQL extension tablefunc to work.