'Extracts constraints for table from schema.
@param table_name: name of the table to process.
@return: (table_name, constraint_iter) where constraint_iter yields
the names of tables on which this table depends.'

def get_table_info(self, table_name):

    self.db.query(('SHOW    CREATE    TABLE    %s;' % table_name))
    result = self.db.store_result()
    table_schema = result.fetch_row(1)[0][1]
    def constraint_iter():
        '    Find    constraints    in    the    schema,    yield    the    primary    table    name.\n\n                                                SHOW    CREATE    TABLE    returns    one    line    with    the    entire    create    table\n                                                command.        As    with    .table    files,    onstraint    clauses    contain    the    word\n                                                REFERENCES    and    the    following    term    (minus    punctuation)    is    the\n                                                dependent    table    name).\n                                                '
        terms = self.cleanup(table_schema).split()
        while (len(terms) > 0):
            try:
                primary_index = (terms.index('REFERENCES') + 1)
            except:
                break
            if (len(terms) > primary_index):
                primary_name = terms[primary_index]
                terms = terms[(primary_index + 1):]
                (yield primary_name)
    return (table_name, constraint_iter)
