A repository implementation for data persistence.
Project description
Data Persistence Repository SQL
Data Persistence Repository SQL is a Python package providing a portable SQL repository implementation, following the repository pattern for a data persistence layer. This package facilitates interaction with SQL databases through an abstracted interface, ensuring clean and maintainable database interaction in Python applications.
Features
- Abstract repository interface for streamlined data layer interactions.
- SQL repository implementation leveraging SQLAlchemy.
- Context manager for robust database session management.
- Comprehensive methods for CRUD operations (Create, Read, Update, Delete).
- Support for filtering and bulk operations.
Installation
Install Data Persistence Repository SQL from PyPI:
pip install data_persistence_repository
Usage
Basic usage example:
from data_persistence_repository.sql_repository import SqlRepository
# Initialize the repository
repo = SqlRepository("sqlite:///your_database.db")
# Use the repository within a managed context
with repo.start_session() as session:
# Perform add, get, delete operations here
Replace "sqlite:///your_database.db"
with your actual database URL.
Requirements
- Python 3.x
- Dependencies listed in
requirements.txt
.
Running Tests
Execute tests using pytest:
pytest
Contributing
Contributions are welcomed! For substantial changes, please open an issue first to discuss what you'd like to change. Please make sure to update tests accordingly.
License
For more information on the repository pattern and its benefits in data persistence, please visit Repository Pattern Information.
Project details
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
Hashes for data_persistence_repository-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d871aa25770b0a9c0d70594eeeef7096876978dfbb8b6c0cbcbd411ba1c6d9f9 |
|
MD5 | dbb077ace4830afb192c9b151b9c8903 |
|
BLAKE2b-256 | b870765bb9d49ee34e2b7ad115d44b745d2032464a12a0ffe76fe6a80216d1a1 |
Hashes for data_persistence_repository-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eee784215c241c5c920573770f2df483a9fbf8b2c365e4b51bbe58bc185b0bee |
|
MD5 | 8f4703b741d40d47ebb5ff9b0cd27ae8 |
|
BLAKE2b-256 | 79380a3656769e8ca463b8b1085062b7b5e804348266dec0d3dd786520471433 |