peepDB is an open-source command-line tool and Python library designed for developers and database administrators who need a fast and efficient way to inspect their database tables without writing SQL queries. With support for MySQL, PostgreSQL, MariaDB, SQLite, MongoDB and Firebase. peepDB is lightweight, secure, and incredibly easy to use.
Here's a quick demonstration of peepDB:
Note: The above image reflects the commands used in the official release (v0.1.3)
You can install peepDB directly from PyPI:
pip install peepdb
peepDB uses a command-based structure for easier and more intuitive use. Here are the main commands with examples:
For SQLite:
peepdb save mydb --db-type sqlite --host /path/to/mydb.sqlite --database mydb
For other databases:
peepdb save <connection_name> --db-type [mysql/postgres/mariadb/mongodb/firebase] --host <host> --user <user> --password <password> --database <database>
Important Note on Password Handling: The password is required as a command-line argument. While this is convenient for scripting, it's important to note that this method can be insecure as the password may be visible in your command history or to other users who can view your screen or process list.
Example:
peepdb save myapp_db --db-type mysql --host localhost --user root --password my_secure_password --database myapp
For improved security, consider using environment variables or a configuration file to store sensitive information like passwords.
peepdb list
Example output:
Saved connections:
- myapp_db (mysql)
- analytics_db (postgres)
View all tables:
peepdb view <connection_name>
View a specific table:
peepdb view <connection_name> --table <table_name>
Example:
peepdb view myapp_db --table users
Output:
Table: users
+----+----------+----------------------+
| id | username | email |
+====+==========+======================+
| 1 | johndoe | johndoe@example.com |
| 2 | janedoe | janedoe@example.com |
+----+----------+----------------------+
Page 1 of 1 (Total rows: 2)
Use pagination to handle large datasets:
peepdb view <connection_name> --table <table_name> --page <page_number> --page-size <rows_per_page>
Example:
peepdb view myapp_db --table users --page 2 --page-size 50
Get output in JSON format:
peepdb view <connection_name> --format json
Example:
peepdb view myapp_db --table users --format json
Output:
{
"users": {
"data": [
{"id": 1, "username": "johndoe", "email": "johndoe@example.com"},
{"id": 2, "username": "janedoe", "email": "janedoe@example.com"}
],
"page": 1,
"total_pages": 1,
"total_rows": 2
}
}
Remove a specific connection:
peepdb remove <connection_name>
Remove all connections:
peepdb remove-all
peepDB implements several security measures to protect your database connection details:
Contributions to peepDB are welcome! Please refer to our Contributing Guide for more information.
Distributed under the GNU General Public License Version 3. See the LICENSE file for more details.
For more detailed documentation, please visit our GitHub Pages.