Your Guide to peepDB: A Command-Line Tool for Database Inspections

Aug 10, 2024 | Programming

If you’ve ever found yourself wrestling with complex SQL queries, you’re certainly not alone. Enter peepDB, an open-source command-line tool and Python library designed to simplify the database inspection process. With support for MySQL, PostgreSQL, MariaDB, SQLite, MongoDB, and Firebase, peepDB offers a lightweight, secure, and user-friendly solution for developers and database administrators alike.

Features of peepDB

  • Multi-Database Support: Works seamlessly with MySQL, PostgreSQL, MariaDB, SQLite, MongoDB, and Firebase.
  • Quick Data Inspection: View all tables or a specific one with a simple command.
  • User-Friendly CLI: An easy-to-use command-line interface powered by Click.
  • Secure Local Storage: Store database connection details securely with encryption.
  • Lightweight: Minimal footprint means it’s designed for speed.
  • Formatted Output: View data in clean, formatted tables or JSON format.
  • Pagination: Handle large datasets effortlessly by breaking them into manageable chunks.

peepDB in Action

Imagine having a magic wand that lets you peek into your database without the hassle of complex SQL. That’s exactly what peepDB does. Here’s a quick demonstration:

peepDB Demo peepDB example 2

Installation of peepDB

Getting started with peepDB is a breeze. You can install it directly from PyPI. Simply run:

pip install peepdb

Usage Instructions

peepDB has a straightforward command-based structure. Let’s break it down into manageable steps:

1. Save Your Database Connection Details

First, you need to save your database connection details. For SQLite, use:

peepdb save mydb --db-type sqlite --host pathtomydb.sqlite --database mydb

For other databases, you’d use:

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 command-line method for including passwords could expose them in command history, so consider using environment variables for better security.

2. List Saved Connections

To view your saved connections, simply type:

peepdb list

This will display a list of saved database connections.

3. View Tables

You can quickly inspect data by viewing all tables or a specific table:

peepdb view connection_name --table table_name

4. Pagination

When working with large datasets, pagination is your ally:

peepdb view connection_name --table table_name --page page_number --page-size rows_per_page

5. Choose Output Format

peepDB allows you to output data in JSON format:

peepdb view connection_name --format json

6. Remove Saved Connections

If you need to tidy up, you can remove specific connections:

peepdb remove connection_name

Troubleshooting Tips

If you encounter any issues while using peepDB, here are a few troubleshooting tips:

  • Ensure that the database is running and accessible.
  • Double-check your connection details (host, username, and password).
  • Make sure peepDB is installed and updated to the latest version.
  • Consult the official documentation for advanced configurations.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Security Overview

peepDB incorporates several vital security measures:

  • Local Storage: Stores connection details locally on your machine.
  • Encryption: Uses cryptography to encrypt connection details before storage.
  • Caution with Passwords: Be mindful when using command-line passwords in shared environments.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Contributing

Your contributions to peepDB are always welcome! For more information, refer to our Contributing Guide.

License

peepDB is distributed under the GNU General Public License Version 3. For more details, see the LICENSE file.

Conclusion

By streamlining the process of database inspections, peepDB empowers developers to focus more on building great software and less on complex SQL queries. Its ease of use, combined with robust features, makes it an indispensable tool in any developer’s toolkit.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox