InspectDB on legacy postgres DB generating blank model with error text: cannot unpack non-iterable nonetype object

New to Django and Postgres so bear with me.

When I attempt to create a model from an existing django table using:

python manage.py inspectdb tblProcessRequests > my_models.py

I receive the noted error within the my_models.py file and no models created.

When I run it without the table parameter it creates models but only for what look to be system tables:

I have tried a couple things after researching. I added a new schema and added the table to that schema (not in the public schema) but cannot seem to get it to create the necessary models. Any help is greatly appreciated.

This seems like a genuine bug. The stacktrace would be very useful to see. Also if you could try reproducing it on the latest version of Django (3.1 RC1) that would be good. If it still errors there, you can report it as a bug. It would be very useful to see a a schema description of the problematic table.

If you have any experience with PDB you can run python -m pdb manage.py inspectdb and use it to debug the error further as well.

1 Like