{"id":37064233,"url":"https://github.com/flipbit03/sqlalchemy-easy-softdelete","last_synced_at":"2026-01-25T05:05:03.022Z","repository":{"id":59113415,"uuid":"529716799","full_name":"flipbit03/sqlalchemy-easy-softdelete","owner":"flipbit03","description":"Easily add soft-deletion to your SQLAlchemy Models","archived":false,"fork":false,"pushed_at":"2024-04-18T07:40:31.000Z","size":174,"stargazers_count":70,"open_issues_count":7,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-01-14T09:24:50.819Z","etag":null,"topics":["python","sqlalchemy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flipbit03.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-08-27T23:14:30.000Z","updated_at":"2026-01-06T03:38:03.000Z","dependencies_parsed_at":"2023-02-08T20:16:26.613Z","dependency_job_id":null,"html_url":"https://github.com/flipbit03/sqlalchemy-easy-softdelete","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/flipbit03/sqlalchemy-easy-softdelete","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipbit03%2Fsqlalchemy-easy-softdelete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipbit03%2Fsqlalchemy-easy-softdelete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipbit03%2Fsqlalchemy-easy-softdelete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipbit03%2Fsqlalchemy-easy-softdelete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flipbit03","download_url":"https://codeload.github.com/flipbit03/sqlalchemy-easy-softdelete/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipbit03%2Fsqlalchemy-easy-softdelete/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28744421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T02:46:29.005Z","status":"ssl_error","status_checked_at":"2026-01-25T02:44:29.968Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","sqlalchemy"],"created_at":"2026-01-14T07:30:22.611Z","updated_at":"2026-01-25T05:05:03.016Z","avatar_url":"https://github.com/flipbit03.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQLAlchemy Easy Soft-Delete\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sqlalchemy-easy-softdelete?v=1)](https://pypi.org/project/sqlalchemy-easy-softdelete/)\n[![PyPI - Version](https://img.shields.io/pypi/v/sqlalchemy-easy-softdelete?v=1)](https://pypi.org/project/sqlalchemy-easy-softdelete/)\n[![PyPI - Types](https://img.shields.io/pypi/types/sqlalchemy-easy-softdelete?v=1)](https://pypi.org/project/sqlalchemy-easy-softdelete/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/sqlalchemy-easy-softdelete?v=1)](https://pypi.org/project/sqlalchemy-easy-softdelete/)\n![Supported SQLAlchemy Versions](https://img.shields.io/badge/SQLAlchemy-1.4%20%2F%202.0-brightgreen?v=1)\n\nEasily add soft-deletion to your SQLAlchemy Models and automatically filter out soft-deleted objects from your queries and relationships.\n\nThis package can generate a tailor-made SQLAlchemy Mixin that can be added to your SQLAlchemy Models, making them contain a field that, when set, will mark the entity as being soft-deleted.\n\nThe library also installs a hook which dynamically rewrites all selects which are sent to the database for all tables that implement the soft-delete mixin, providing a seamless experience in both manual queries and model relationship accesses.\n\nMixin generation is fully customizable and you can choose the field name, its type, and the presence of (soft-)delete/undelete methods.\n\nThe default implementation will generate a `deleted_at` field in your models, of type `DateTime(timezone=True)`, and will also provide a `.delete(v: Optional = datetime.utcnow())` and `.undelete()` methods.\n\n### Installation:\n\n```\npip install sqlalchemy-easy-softdelete\n```\n\n### How to use:\n\n```py\nfrom sqlalchemy_easy_softdelete.mixin import generate_soft_delete_mixin_class\nfrom sqlalchemy_easy_softdelete.hook import IgnoredTable\nfrom sqlalchemy.orm import declarative_base\nfrom sqlalchemy import Column, Integer\nfrom datetime import datetime\n\n# Create a Class that inherits from our class builder\nclass SoftDeleteMixin(generate_soft_delete_mixin_class(\n    # This table will be ignored by the hook\n    # even if the table has the soft-delete column\n    ignored_tables=[IgnoredTable(table_schema=\"public\", name=\"cars\"),]\n)):\n    # type hint for autocomplete IDE support\n    deleted_at: datetime\n\n# Apply the mixin to your Models\nBase = declarative_base()\n\nclass Fruit(Base, SoftDeleteMixin):\n    __tablename__ = \"fruit\"\n    id = Column(Integer)\n```\n\n### Example Usage:\n\n```py\nall_active_fruits = session.query(Fruit).all()\n```\nThis will generate a query with an automatic `WHERE fruit.deleted_at IS NULL` condition added to it.\n\n```py\nall_fruits = session.query(Fruit).execution_options(include_deleted=True).all()\n```\nSetting `include_deleted=True` (attribute name can be customized) in the query disables soft delete for that query.\n\n### Contributing\n\nContributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.\n\n### License\n\n* BSD-3-Clause\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflipbit03%2Fsqlalchemy-easy-softdelete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflipbit03%2Fsqlalchemy-easy-softdelete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflipbit03%2Fsqlalchemy-easy-softdelete/lists"}