def get_wrong_volume_attachments(meta):
    wrong_attachments = {}
    volume_attachment_t = Table('volume_attachment', meta, autoload=True)
    volumes_t = Table('volumes', meta, autoload=True)
    attachment_join = volume_attachment_t.join(volumes_t, (volume_attachment_t.c.volume_id == volumes_t.c.id))
    columns = [volumes_t.c.id, volumes_t.c.deleted, volume_attachment_t.c.id, volume_attachment_t.c.deleted]
    wrong_volume_attachment_q = select(columns=columns).select_from(attachment_join).where(and_((volumes_t.c.deleted == 1), (volume_attachment_t.c.deleted == 0)))
    for (volume_id, volume_deleted, volume_attachment_id, volume_attachment_deleted) in wrong_volume_attachment_q.execute():
        wrong_attachments[volume_attachment_id] = volume_id
    return wrong_attachments
def get_wrong_volume_attachments(meta):
    wrong_attachments = {}
    volume_attachment_t = Table('volume_attachment', meta, autoload=True)
    volumes_t = Table('volumes', meta, autoload=True)
    attachment_join = volume_attachment_t.join(volumes_t, (volume_attachment_t.c.volume_id == volumes_t.c.id))
    columns = [volumes_t.c.id, volumes_t.c.deleted, volume_attachment_t.c.id, volume_attachment_t.c.deleted]
    wrong_volume_attachment_q = select(columns=columns).select_from(attachment_join).where(and_((volumes_t.c.deleted == 1), (volume_attachment_t.c.deleted == 0)))
    for (volume_id, volume_deleted, volume_attachment_id, volume_attachment_deleted) in wrong_volume_attachment_q.execute():
        wrong_attachments[volume_attachment_id] = volume_id
    return wrong_attachments