Question: Django inspectdb skips tables with constraints

Question

Django inspectdb skips tables with constraints

Answers 0
Added at 2017-01-05 05:01
Tags
Question

I read a few topics on this, but none really seemed to offer a solution in inspectdb, or an alternative, that permits Django to make models for an existing database where some of the tables have constraints.

So I ran python manage.py inspectdb > models.py. It did a mostly good job of creating models for the existing database that do require some tweaks, but is mostly done. However, it skips tables that have constraints on them, saying:

Unable to inspect table 'users'
The error was: list index out of range

Duplicate the table and remove constraints, it now compiles a model for the table. Cool. Just manually add them back.

Is there a way to get inspectdb to include tables with constraints? Or an alternative tool that compiles models from tables in an existing databases? PostgreSQL in this case.

Answers to

Django inspectdb skips tables with constraints

Source Show
◀ Wstecz