Ticket #14098: 14098-3.diff

File 14098-3.diff, 1.5 KB (added by Claude Paroz, 11 years ago)

Output errors

  • django/core/management/commands/inspectdb.py

    diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
    index 89549dc..acdbeb3 100644
    a b class Command(NoArgsCommand):  
    5656            if table_name_filter is not None and callable(table_name_filter):
    5757                if not table_name_filter(table_name):
    5858                    continue
    59             yield 'class %s(models.Model):' % table2model(table_name)
    60             known_models.append(table2model(table_name))
    6159            try:
    6260                relations = connection.introspection.get_relations(cursor, table_name)
    6361            except NotImplementedError:
    6462                relations = {}
     63            except Exception as e:
     64                yield "# Unable to inspect table %s" % table_name
     65                yield "# The error was: %s" % e
     66                continue
    6567            try:
    6668                indexes = connection.introspection.get_indexes(cursor, table_name)
    6769            except NotImplementedError:
    6870                indexes = {}
     71
     72            yield 'class %s(models.Model):' % table2model(table_name)
     73            known_models.append(table2model(table_name))
    6974            used_column_names = [] # Holds column names used in the table so far
    7075            for i, row in enumerate(connection.introspection.get_table_description(cursor, table_name)):
    7176                comment_notes = [] # Holds Field notes, to be displayed in a Python comment.
Back to Top