tutorial on using dbshell?

1,191 views
Skip to first unread message

jjander...@gmail.com

unread,
May 22, 2017, 5:20:27 PM5/22/17
to Django users

I'm working with Django 1.10.3 and I'm trying to look at the database tables generated by Django using makemigrations and migrate. I was looking to use 'python manage.py sql', but it looks like that is no longer available. In a recent question to Django users, I was advised to use dbshell which I am planning to do, but thus fair I have not found and instructions or a tutorial on how to use deshell. Can someone point me to instructions?

Thank you.

Jim A.

James Schneider

unread,
May 22, 2017, 5:28:23 PM5/22/17
to django...@googlegroups.com


On May 22, 2017 2:20 PM, <jjander...@gmail.com> wrote:

I'm working with Django 1.10.3 and I'm trying to look at the database tables generated by Django using makemigrations and migrate. I was looking to use 'python manage.py sql', but it looks like that is no longer available. In a recent question to Django users, I was advised to use dbshell which I am planning to do, but thus fair I have not found and instructions or a tutorial on how to use deshell. Can someone point me to instructions?

The dbshell command is simply a convenience command for opening the standard management console for your specific database. That interface will be different depending on the type of database you are using (MySQL, Postgres, or SQLite). You can find the commands for each database management tool by searching for "<database type> commands tutorial", as an example.

-James

Jim Anderson

unread,
May 22, 2017, 6:08:09 PM5/22/17
to django...@googlegroups.com
Hi James,

I'm looking at the sqlite3 documentation now, but I'm still not quite sure how to run the dbshell. Once I am in the shell, I assume that I can run sqlite3 commands as needed. But when I enter:

% python manage.py dbshell

I get the following error messages:

setting.py: BASE_DIR =  /home/jja/...
FINISHED settings.py
CommandError: You appear not to have the 'sqlite3' program installed or on your path.


Am I invoking it properly? Do I have to change my configuration?

Jim A.


--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/YYgAsqFhT8w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWZyW7Q_xzDYrEBFzAHSjDD_XBBD%2Bh2XGbOCoePcFLueA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

James Schneider

unread,
May 22, 2017, 6:36:16 PM5/22/17
to django...@googlegroups.com


On May 22, 2017 3:07 PM, "Jim Anderson" <jjander...@gmail.com> wrote:
Hi James,

I'm looking at the sqlite3 documentation now, but I'm still not quite sure how to run the dbshell. Once I am in the shell, I assume that I can run sqlite3 commands as needed. But when I enter:

% python manage.py dbshell

I get the following error messages:

setting.py: BASE_DIR =  /home/jja/...
FINISHED settings.py
CommandError: You appear not to have the 'sqlite3' program installed or on your path.


Am I invoking it properly? Do I have to change my configuration?

From a Django perspective, it looks correct. You'll need to install the sqlite3 management package do that Django has access to it. In most cases, if you are able to run the sqlite3 command by itself, Django should be able to find it. How you install it is going to be dependent on your OS. Linux distributions should have it really available in their package repositories, and the necessary package for Windows should be available on it's project page.

-James

Jim Anderson

unread,
May 23, 2017, 9:00:23 AM5/23/17
to django...@googlegroups.com

James,

Thank you, again.

I have install the sqlite command line package and all is working for me.

Jim A.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/YYgAsqFhT8w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages