I have an existing MySQL database with several tables already populated with data. I created and configured a Django project with an application. Communication between Django and the database works as expected. I have generated a 'models.py' using 'inspectdb' command to create all my application models:
python manage.py inspectdb > myapp/models.py
My issue is that none of my models shows any 'id' field in 'models.py'. All existing MySQL tables having an 'id' column as primary key (auto increment being enabled for those) it seems weird.
I wonder if I need to explicitly add 'id' primary keys fields in all model classes created with inspectdb or if it is not needed (it would be implicit in that case).
Why 'id' primary key is missing from Django models definitions and should I add this field to the models classes?
Current setup
- Python version: 3.6.8
- Django version: 2.2.5
- mysqlclient: 1.4.4
- sqlparse: 0.3.0