def table_info()

in src/ab/plugins/db/rds.py [0:0]


    def table_info(self, table_name, with_row_count=False):
        '''
        returns table info in db
        returns: {
            'type': data source type,
            'size': table size in KB,
            'row_count': row count in db, optional,
            'columns': [
                    {'field': 'name', 'type': 'varchar(100)', 'xlabType': 'String', 'comment': '公司名称'},
                    {'field': 'f1', 'type': 'double', 'xlabType': 'Double', comment': '年总销售额'}
                ]
        '''
        columns = self.get_column_meta(table_name)
        columns = [{first_char_lower(k): v for k, v in column.items()} for column in columns]
        for column in columns:
            column['xlabType'] = self.rds_to_xlab_type(column['type'])
        table_size = self.get_table_size_in_KB(table_name)
        ret = {
            'type': 'mysql',
            'size': table_size,
            'columns': columns
        }
        if with_row_count:
            ret['row_count'] = self.count(table_name)
        return ret