def get_primary_keys(self, table_name, echo=False):
    'Get PK metadata for table'
    Rec = namedtuple('PKs', 'schema table pk_name column_name column_order')
    self._fields = Rec._fields
    (schema, table) = self._split_schema_table(table_name)

    def get_rec(col, pk_name, column_order):
        r_dict = {}
        r_dict['schema'] = schema
        r_dict['table'] = table
        r_dict['pk_name'] = pk_name
        r_dict['column_name'] = col
        r_dict['column_order'] = column_order
        return Rec(**r_dict)
    sql_tmpl = self._template('metadata.primary_keys')
    if sql_tmpl:
        rows = self.query(sql_tmpl.format(table=table, schema=schema))
    else:
        self.get_engine(echo=echo)
        r_dict = self.engine_inspect.get_pk_constraint(table, schema=schema)
        rows = [get_rec(col, r_dict['name'], (i + 1)) for (i, col) in enumerate(r_dict['constrained_columns'])]
    return rows
Get PK metadata for table
def get_primary_keys(self, table_name, echo=False):
    
    Rec = namedtuple('PKs', 'schema table pk_name column_name column_order')
    self._fields = Rec._fields
    (schema, table) = self._split_schema_table(table_name)

    def get_rec(col, pk_name, column_order):
        r_dict = {}
        r_dict['schema'] = schema
        r_dict['table'] = table
        r_dict['pk_name'] = pk_name
        r_dict['column_name'] = col
        r_dict['column_order'] = column_order
        return Rec(**r_dict)
    sql_tmpl = self._template('metadata.primary_keys')
    if sql_tmpl:
        rows = self.query(sql_tmpl.format(table=table, schema=schema))
    else:
        self.get_engine(echo=echo)
        r_dict = self.engine_inspect.get_pk_constraint(table, schema=schema)
        rows = [get_rec(col, r_dict['name'], (i + 1)) for (i, col) in enumerate(r_dict['constrained_columns'])]
    return rows