Universal database explorer with visual query tools and dashboards. Cross-platform GUI built with PyQt5 and Python.
- Multi-Database Support: Connect to SQLite, PostgreSQL, and MySQL databases
- Schema Browser: Explore database structure including tables, columns, indexes, and foreign keys
- Visual Query Builder: Build SQL queries visually with drag-and-drop interface
- SQL Editor: Write and execute raw SQL with syntax highlighting
- Result Tables: View query results in sortable, filterable tables
- Data Visualization: Create charts (bar, line, pie, scatter) from query results
- Export Tools: Export data to CSV, JSON, and Excel formats
- Modular Architecture: Easy to extend with new database drivers
The application provides a professional Qt-based interface with:
- Left panel: Database schema tree view
- Right panel: Tabbed interface for SQL editor, query builder, results, and charts
- Toolbar: Quick access to common operations
- Status bar: Connection status and query feedback
- Python 3.8 or higher
- pip package manager
pip install -r requirements.txtOr install manually:
pip install PyQt5 psycopg2-binary PyMySQL matplotlib pandas openpyxl Pygmentspip install -e .# Using the launcher script
python run.py
# Or using the installed command
qt-db-explorer
# Or running the module directly
python -m db_explorer.main- Click File > Connect or use the toolbar button
- Select database type (SQLite, PostgreSQL, or MySQL)
- Enter connection parameters:
- SQLite: Browse for database file
- PostgreSQL/MySQL: Enter host, port, database, username, and password
- Click Test Connection to verify settings
- Click Connect to establish connection
- The left panel displays the database schema tree
- Expand databases to view tables
- Expand tables to view columns, indexes, and foreign keys
- Double-click a table to browse its data
- Right-click for context menu options
- Switch to the SQL Editor tab
- Type or paste your SQL query
- Click Execute Query or press F5
- Results appear in the Results tab
- Switch to the Query Builder tab
- Select a table from the dropdown
- Select columns to include in the query
- Add WHERE conditions as needed
- Configure ORDER BY and LIMIT
- Click Generate SQL to create the query
- The query is displayed in the SQL Editor
- Results appear in a sortable table
- Click column headers to sort
- Use export buttons to save data:
- Export CSV: Save as comma-separated values
- Export JSON: Save as JSON array
- Export Excel: Save as Excel workbook
- Execute a query to get data
- Switch to the Charts tab
- Click Create Chart
- Configure chart options:
- Chart type (bar, line, pie, scatter)
- X-axis column
- Y-axis column
- The chart is displayed with zoom and pan controls
The application uses a modular driver architecture. Each database type has its own driver class:
- SQLiteDriver: For SQLite databases
- PostgreSQLDriver: For PostgreSQL databases
- MySQLDriver: For MySQL/MariaDB databases
To add support for a new database:
- Create a new driver class in
db_explorer/drivers/ - Extend the
DatabaseDriverbase class - Implement all abstract methods
- Register the driver in
db_explorer/drivers/__init__.py - Update the connection dialog to support the new type
qt-db-explorer/
├── db_explorer/ # Main package
│ ├── __init__.py
│ ├── main.py # Application entry point
│ ├── main_window.py # Main window implementation
│ ├── drivers/ # Database drivers
│ │ ├── __init__.py
│ │ ├── base_driver.py # Abstract base class
│ │ ├── sqlite_driver.py
│ │ ├── postgresql_driver.py
│ │ └── mysql_driver.py
│ └── widgets/ # UI widgets
│ ├── __init__.py
│ ├── connection_dialog.py
│ ├── schema_browser.py
│ ├── sql_editor.py
│ ├── result_table.py
│ ├── query_builder.py
│ └── chart_widget.py
├── requirements.txt # Python dependencies
├── setup.py # Package setup
├── run.py # Launcher script
└── README.md # This file
- PyQt5: Qt GUI framework for Python
- psycopg2-binary: PostgreSQL database adapter
- PyMySQL: MySQL database adapter
- matplotlib: Plotting library for charts
- pandas: Data manipulation (optional, for advanced features)
- openpyxl: Excel file support
- Pygments: Syntax highlighting (optional enhancement)
The application stores connection history and preferences in the Qt settings system. No manual configuration is required.
- Database passwords are not stored persistently
- Use read-only database accounts when exploring production databases
- Be careful with UPDATE, DELETE, and DROP statements
- The application commits changes immediately - there's no "preview mode"
- Verify the database server is running
- Check firewall settings allow connections
- Confirm username and password are correct
- Ensure the database exists
- Verify the file path is correct
- Check file permissions
- For new databases, create an empty file first
- Ensure matplotlib is installed correctly
- Verify the data columns contain numeric values
- Try a different chart type
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
BaseMax
1.0.0