Skip to main content

A repository implementation for data persistence.

Project description

Data Persistence Repository SQL

PyPI Build Status Coverage Status

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

MIT


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

data_persistence_repository-0.1.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page