Brings transparent soft delete to SQLAlchemy ORM
Project description
Brings transparent soft delete to SQLAlchemy ORM.
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
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
sqla-paranoid-0.1.1.tar.gz
(4.1 kB
view details)
File details
Details for the file sqla-paranoid-0.1.1.tar.gz
.
File metadata
- Download URL: sqla-paranoid-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bcc810c5eb41c280a7ada9f2504342abb8e5c21ec458c5f2fea09384d837c09 |
|
MD5 | b827945fce5de8f71508dc56a5f009e4 |
|
BLAKE2b-256 | 6a07c0a1b787324b8ce02fb92edf667bb3099ca8db38008d3806feafa7e4ccda |