HukeLau_DABA
HukeLau_DABA

Reputation: 2528

SQLite3 ".tables" returns nothing

I just installed Django 1.5.1 with Python 2.7. SQLite3 comes with it. I ran "python manage.py syncdb", which ran successfully and now I want to see what tables were created. I ran the sqlite3 cmd line tool and in a sqlite prompt I did the following:

  1. ATTACH '/home/thisUser/PyWorkspace/dbfile.db' AS dbf; //I noticed this got rid of the temp database
  2. .databases confirms the name of the db is associated with dbfile.db, which is 2 directories up from my current directory that I ran the "sqlite3" command to start the sqlite cmd line.
  3. .tables returns no tables!

What did I do wrong? Thanks

Upvotes: 5

Views: 6674

Answers (2)

mdforbes500
mdforbes500

Reputation: 41

If your current working directory contains the database, then you can more simply use

sqlite3 ./dbfile.db

This saves you a lot of typing in path names. Alternately you can export the PATH at the start of your session.

Upvotes: 4

Ye Liu
Ye Liu

Reputation: 8986

.tables shows master db tables. Try this:

$ sqlite3 /home/thisUser/PyWorkspace/dbfile.db

then

sqlite> .tables

Upvotes: 9

Related Questions