Skip to content

Brings transparent soft delete to SQLAlchemy ORM.

Notifications You must be signed in to change notification settings

Fufutako/sqla-paranoid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paranoid

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

About

Brings transparent soft delete to SQLAlchemy ORM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%