Skip to content

Turning on hard_delete seems to delete more data than intended #340

@oliviagunton

Description

@oliviagunton

While investigating data that was unexpectedly missing after we turned on hard_delete in our config, we noticed that this delete statement seems to delete all rows:

            if self.config["hard_delete"] is True:
                delete_stmt = sa.delete(target_table).where(
                    sa.or_(
                        target_table.c[self.version_column_name].is_(None),
                        target_table.c[self.version_column_name] <= new_version,
                    )
                )

Is it possible that comparison operator should be < rather than <= and it should preserve rows where target_table.c[self.version_column_name] == new_version? (It turns out hard_delete won't work for us for a variety of other reasons related to Redshift, but figured we should say something in case this impacts others.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions