How to view database and schema of django sqlite3 db

Goto the folder where the database is and then

sqlite3  db.sqlite3

Then

.tables

or
.schema

depending on what you want. Instead of invoking sqlite3 directly you could do

 python manage.py dbshell 

and then type the sqlite commands.

If you are working with a legacy database you can generate Django models for that using the

 python manage.py inspectdb

please see https://docs.djangoproject.com/en/3.0/ref/django-admin/#django-admin-inspectdb for additional info.

But please do yourself a favour and get a GUI database client. Life is much easier when you have one.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)