def __createPivotTable__(conn, output_table, col_types_dict, col_names_and_types_lst, label):
    cnames_and_types = ', '.join(['  '.join(pair) for pair in col_names_and_types_lst])    
    stmt = ''' '''
    data_dict = {}
    data_dict['output_table'] = output_table
    data_dict['col_names_and_types'] = cnames_and_types
    if(col_types_dict.has_key('id') and label):
        stmt = '''
                 drop table if exists {output_table} cascade;
                 create table {output_table}
                 ({id_col}   {id_col_type},
                  {col_names_and_types},
                  {label_col_name}  {label_col_type}
                 );
               '''
        data_dict['id_col'] = 'id'
        data_dict['id_col_type'] = col_types_dict['id']
        data_dict['label_col_name'] = label
        data_dict['label_col_type'] = col_types_dict[label]
    elif(col_types_dict.has_key('id')):
        #ID column exists, but there is no label column specified
        stmt = '''
                 drop table if exists {output_table} cascade;
                 create table {output_table}
                 ({id_col}   {id_col_type},
                  {col_names_and_types}
                 );
               '''
        data_dict['id_col'] = 'id'
        data_dict['id_col_type'] = col_types_dict['id']
    else:
        #Neither ID column nor label column exists (i.e there only are features in the table)
        stmt = '''
                 drop table if exists {output_table} cascade;
                 create table {output_table}
                 (
                  {col_names_and_types}
                 );
               '''
    stmt = stmt.format(**data_dict)
    psql.execute(stmt, conn.getConnection())
Parse in the Rrc822 message from the XML definition.
dataset/ETHPy150Open pivotalsoftware/pymadlib/pymadlib/utils.py/__createPivotTable__--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/vendor/gdata/apps/migration/__init__.py/Rfc822MsgFromString