-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add soft deletion support #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
…variable naming Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for soft deletion feature
Add soft deletion support for async-sqlalchemy-adapter
Nov 23, 2025
Copilot finished work on behalf of
nomeguy
November 23, 2025 07:19
|
@copilot fix failed linter check: |
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Contributor
Author
Copilot finished work on behalf of
nomeguy
November 23, 2025 07:46
hsluoyz
added a commit
that referenced
this pull request
Nov 23, 2025
github-actions bot
pushed a commit
that referenced
this pull request
Nov 23, 2025
# [1.15.0](v1.14.0...v1.15.0) (2025-11-23) ### Features * add soft deletion support ([#20](#20)) ([da6a819](da6a819))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Soft Deletion Support Implementation ✅
Based on sqlalchemy-adapter PR #72, I've successfully implemented soft deletion support for the async-sqlalchemy-adapter.
Implementation Checklist:
db_class_softdelete_attribute)_softdelete_query()helper method to filter out deleted recordsload_policy()to use soft delete filteringload_filtered_policy()to use soft delete filteringsave_policy()to support soft delete logic (set flag instead of deleting)remove_policy()to set deletion flag instead of deletingremove_policies()to set deletion flag instead of deletingremove_filtered_policy()to set deletion flag instead of deletingupdate_policy()to filter out soft deleted records_update_filtered_policies()to filter out soft deleted recordsSummary
This PR adds soft deletion support to the async-sqlalchemy-adapter, enabling users to mark database records as deleted instead of physically removing them. This is particularly useful for audit trails, compliance requirements, and undo functionality.
Key Changes:
db_class_softdelete_attributeparameter to accept a Boolean column attribute for soft delete functionality_softdelete_query()helper method that uses SQLAlchemy'snot_()operator to filter out soft-deleted recordsremove_policy(),remove_policies(), andremove_filtered_policy()to set deletion flags instead of hard deleting when soft delete is enabledload_policy()andload_filtered_policy()to automatically filter out soft-deleted recordsupdate_policy()and_update_filtered_policies()to work correctly with soft delete filteringtest_adapter_softdelete.pycovering all soft deletion scenariosTesting
Backward Compatibility
This feature is fully backward compatible. When
db_class_softdelete_attributeis not provided, the adapter continues to use hard deletion as before. Existing code requires no changes.Security
CodeQL security analysis completed with zero vulnerabilities found.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.