0

I'm trying to create a model for terms table in models.py file using inspectdb command in Django project. The terms table contains information about students and their GPA for three grades. I'm using Oracle 18 database and Django 3.2.

When I try to execute this command:

python3 manage.py inspectdb terms > models.py

I get this message:

Unable to inspect table 'terms'

The error was: 'STU_ID'

I don't know what is the error with STU_ID column, it exists in the database and has a valid data type and constraints.

I tried to use --exclude option to exclude the column from inspection, but it didn't work. I got this message:

manage.py inspectdb: error: unrecognized arguments: --exclude

I also tried to use --table-filter option to inspect only terms table, but it also didn't work. I got the same message:

manage.py inspectdb: error: unrecognized arguments: --table-filter

I don't understand why these options are not available in Django 3.2, they are mentioned in the official documentation.

Is there a solution for this problem? How can I create a model for terms table in models.py file?

Thank you.

Mohamed Emad
  • 186
  • 3
  • 5

1 Answers1

0

The error you encountered while using the inspectdb command in Django may be due to compatibility issues or incorrect configuration.

What you can do is, make a small modificatioin your models then migrate the same using

python manager.py makemigrations
python manager.py migrate

And then to inspect a particular table

python3 manage.py inspectdb --database=<your_database_alias> terms > models.py

This may solve your issue

Harshit verma
  • 506
  • 3
  • 25