Tools for Database Operations in Python
Project description
Pitanga
Welcome to Pitanga, the hidden gem of your database operation toolkit in Python! Just like the pitanga fruit, our library is small, vibrant, and packed with value. Pitanga is designed to make your interactions with PostgreSQL databases more efficient, robust, and enjoyable.
Funcionalidades
Pitanga is loaded with features that will transform the way you handle database operations:
- Efficient Connection: Utilize a connection pool to keep your operations fast and stable.
- Batch Queries: Execute SELECT queries in batches, leveraging multithreading to handle large volumes of data with ease.
- Safe Updates and Deletes: Perform UPDATE and DELETE operations with automatic commit, ensuring data integrity.
- Optimized Record Counting: Count records efficiently, even in complex queries with DISTINCT.
- Robust Error Handling: Integrated mechanisms to capture and handle errors effectively, keeping your system resilient.
Installation
You can install the Pitanga library directly from GitHub:
pip install git+https://github.com/cereja-project/pitanga.git
Usage
With Pitanga, your database operations become as easy as enjoying a fresh pitanga. Here's how:
import logging
from pitanga import DatabaseOperations, DataBaseUpdateError, InvalidQueryError
# Basic logging configuration
logging.basicConfig(level=logging.INFO)
# Initialize database operations
db_operations = DatabaseOperations()
# SELECT query
try:
results = db_operations.select("SELECT * FROM my_table", batch_size=100)
for batch in results:
print(batch)
except InvalidQueryError as e:
logging.error(f"Query error: {e}")
except DataBaseUpdateError as e:
logging.error(f"Database update error: {e}")
# UPDATE query
try:
db_operations.update("UPDATE my_table SET column = value WHERE condition")
except InvalidQueryError as e:
logging.error(f"Query error: {e}")
except DataBaseUpdateError as e:
logging.error(f"Database update error: {e}")
# DELETE query
try:
db_operations.delete("DELETE FROM my_table WHERE condition")
except InvalidQueryError as e:
logging.error(f"Query error: {e}")
except DataBaseUpdateError as e:
logging.error(f"Database update error: {e}")
# Close connections
db_operations.close_connection()
Contribution
Pitanga is a community project and we welcome contributions! Feel free to open issues and pull requests on our GitHub repository. Together, we can make Pitanga even sweeter.
Licença
This project is licensed under the MIT License.
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 pitanga-0.0.1.tar.gz.
File metadata
- Download URL: pitanga-0.0.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad991ace50ae9f3b515e1188d33c3993cf66cfb7588ee7ebe78d64de789e8813
|
|
| MD5 |
798af53fc61055d157bf766963a622c5
|
|
| BLAKE2b-256 |
4d722585e981eb1e2c4074908d18f42d63580af8c15f30e17ba26a3645de3a6c
|
File details
Details for the file pitanga-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pitanga-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68a631b18b375daed0cb6daa021f8e96cbca1629c7d0dd9e8a018f2ea1902229
|
|
| MD5 |
d145d2344344171a06d4f5e626166a15
|
|
| BLAKE2b-256 |
fca44b2d3b4018f2151e72821979e992af8259c55e894ba03b279a9ace257db6
|