Viewing Databases
When you're using the SQLite database engine, the database contents are stored in a single file on
your hard drive. Typically, we give this file the extension .db
.
If you want to view this database, you need to use a tool that is capable of working with SQLite databases. There are several such tools, but one is built in to PyCharm.
Connecting with PyCharm
PyCharm has a Database panel; by default, this is over on the right side of the window when you have the panel buttons enabled (if you don't see it, click the window layout button in the far bottom left of the PyCharm window).
To add the data source:
- Open the Database panel
- Click the New Connection menu button — it's the ‘+’ on the left side of the database toolbar
- Choose ‘Data Source’ → ‘SQLite (Xerial)’
- Select your database file (you can browse with the ‘…’ button)
- Click ‘Test Connection’ to make sure it works
- Click OK
Once you have done this, you will have a new database connection in your Database window, and you can expand it to view the tables.
Using the SQLite command line tool
If you know SQL, you can use the sqlite3
command line tool to view the database. It is available from the SQLite web site, and is installable with Homebrew on OS X and your package manager on Linux.