Skip to content

sqlalchemy >= 1.4 breaks the cleanup cli #94

@david-caro

Description

@david-caro

We are getting the following error after upgrading sqlalchemy:

# backy2 cleanup
    INFO: [backy2.logging] $ /usr/bin/backy2 cleanup
    INFO: [backy2.logging] Deleting false positives...
/usr/lib/python3/dist-packages/backy2/meta_backends/sql.py:569: SAWarning: Coercing Subquery object into a select() for use in IN(); please pass a select() construct explicitly
  self.session.query(DeletedBlock.uid).filter(DeletedBlock.uid.in_(self.session.query(Block.uid).distinct(Block.uid).filter(Block.uid.isnot(None)).subquery())).filter(DeletedBlock.time < (inttime() - dt)).delete(synchronize_session=False)
   ERROR: [backy2.logging] subject table for an INSERT, UPDATE or DELETE expected, got Column('uid', String(length=32), table=<deleted_blocks>).
   ERROR: [backy2.logging] Backy failed.


# python3 -c 'import sqlalchemy; print(sqlalchemy.__version__)'
1.4.23

Version 1.4 introduced some extra restrictions to the old api, and a whole new api, and those seem to be breaking that specific contstruct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions