def METHOD_NAME():
    """Delete mappings where the associated table is gone."""
    for mapping in Mapping.all().order_by(Mapping.collection_id.desc()):
        aggregator = get_aggregator(mapping.collection)
        table = _get_table(mapping, aggregator)
        if table is not None:
            continue
        log.info("Orphaned mapping: %s", mapping.id)
        flush_mapping(mapping.collection, mapping.id)
        mapping.delete()
    db.session.commit()