Skip to main content

Brings transparent soft delete to SQLAlchemy ORM

Project description

Brings transparent soft delete to SQLAlchemy ORM.

Build Status

Installation

pip install sqla-paranoid

Usage

from paranoid.models import (
    Model,
    Query,
    Session,
)

class User(Model):
    __tablename__ = 'user'
    __softdelete__ = True

    id = Column(Integer, primary_key=True)
    name = Column(String)


engine = create_engine('sqlite://')
session = sessionmaker(engine, class_=Session, query_cls=Query)()

session.query(User)

Flask

Paranoid comes with a ready to use Flask extension built on top of Flask-SQLAlchemy:

from paranoid.flask import SQLAlchemy


db = SQLAlchemy(app)

Model = db.Model


class User(Model):
    __softdelete__ = True

    id = Column(Integer, primary_key=True)
    name = Column(String)

User.query

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

sqla-paranoid-0.1.1.tar.gz (4.1 kB view hashes)

Uploaded Source

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