Brings transparent soft delete to SQLAlchemy ORM
Project description
Brings transparent soft delete to SQLAlchemy ORM.
Installation
pip install sqla-paranoid
Usage
from .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
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
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.0.tar.gz
(4.0 kB
view details)
File details
Details for the file sqla-paranoid-0.1.0.tar.gz
.
File metadata
- Download URL: sqla-paranoid-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62a6f23c30aba851fba1b5b5b67bf2c83182c4c485cc92b850c77bb439ae12d1 |
|
MD5 | e8d01be755d335b9069b383e20d59cd2 |
|
BLAKE2b-256 | 7debc3073116a1f3d03e0a2ea8116d6a81878794dd0716d59e14eb539b1fa563 |