PostgreSQL database management system with a user-friendly interface
Project description
Pypostgres
A powerful Python interface for PostgreSQL databases that simplifies database interactions and query management.
Features
- Simplified PostgreSQL connection management
- Easy query execution and result handling
- Support for parameterized queries to prevent SQL injection
- Transaction management utilities
- Connection pooling for improved performance
- Comprehensive error handling and logging
Installation
# Clone the repository
git clone https://github.com/Ayman-aa/pypostgres.git
cd pypostegres
# Create and activate a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
Usage
# Import the main class
from pypostegres import DatabaseManager
# Create a database manager instance
db_manager = DatabaseManager()
# Connect to your database
db_manager.selected_db = "your_database"
db_manager.setup()
# Execute a raw query with parameters
success, results = db_manager.execute_raw_query(
"SELECT * FROM users WHERE active = %s",
[True]
)
# Process results
if success:
for row in results:
print(f"User: {row['username']}, Email: {row['email']}")
# Close the connection when done
db_manager.close()
Or alternatively use the CLI:
python3 pypostegres.main
Dependencies
- Python 3.12+
- psycopg2-binary 2.9.10+
Documentation
For more detailed documentation, see the docs/ directory or visit our documentation site.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- psycopg2 - PostgreSQL adapter for Python
- All contributors who have helped this project grow
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file my_py_postgres-0.1.0.tar.gz.
File metadata
- Download URL: my_py_postgres-0.1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f82ac58f56bf04f0eb4b421bae34ed4a712ebcce007c9aebf17625ecac0d9058
|
|
| MD5 |
667a98e7dcf97ae7c66a747191d76c71
|
|
| BLAKE2b-256 |
e794e560f12163dd8a858b197d6b633b2a96cae83ce46e01c52db8a40e7a7410
|
File details
Details for the file my_py_postgres-0.1.0-py3-none-any.whl.
File metadata
- Download URL: my_py_postgres-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7062147f0ed8e4dede58b71ee96d6059e8764221435e0fc6c1d371d8d93ffbff
|
|
| MD5 |
5f6d20a6e9d9cfbbca3b8b0ea1a13df3
|
|
| BLAKE2b-256 |
c066214c244fb652ad7e5fda565325c433dbb23d4df27a65992df3b512e01493
|