• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

corridor / sqlalchemy-history / 25801782794

13 May 2026 01:20PM UTC coverage: 95.68%. First build
25801782794

Pull #170

github

web-flow
Merge 8135f8bd4 into 5fe88b105
Pull Request #170: refactor: add PEP 484 type annotations across the codebase (#164)

286 of 320 new or added lines in 22 files covered. (89.38%)

5471 of 5718 relevant lines covered (95.68%)

9.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/sqlalchemy_history/plugins/null_delete.py
1
import typing as t
10✔
2

3
import sqlalchemy as sa
10✔
4

5

6
if t.TYPE_CHECKING:
10✔
NEW
7
    from sqlalchemy_history.unit_of_work import UnitOfWork
×
8

9
from sqlalchemy_history.operation import Operation
10✔
10
from sqlalchemy_history.plugins.base import Plugin
10✔
11
from sqlalchemy_history.utils import is_internal_column, versioned_column_properties
10✔
12

13

14
class NullDeletePlugin(Plugin):
10✔
15
    def should_nullify_column(self, version_obj: type, prop: sa.orm.properties.ColumnProperty) -> bool:
10✔
16
        """Return whether or not given column of given version object should
17
        be nullified (set to None) at the end of the transaction.
18

19
        :param version_obj: Version object to check the attribute nullification
20
        :paremt prop:
21
            SQLAlchemy ColumnProperty object
22
        """
23
        return (
10✔
24
            version_obj.operation_type == Operation.DELETE
25
            and not prop.columns[0].primary_key
26
            and not is_internal_column(version_obj, prop.key)
27
        )
28

29
    def after_create_version_object(self, uow: "UnitOfWork", parent_obj: t.Any, version_obj: t.Any) -> None:
10✔
30
        for prop in versioned_column_properties(parent_obj):
10✔
31
            if self.should_nullify_column(version_obj, prop):
10✔
32
                setattr(version_obj, prop.key, None)
10✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc