x = Dish.query.filter(Dish.restaurants.any(name=name)).all()
class Restaurant(db.Model): ... dishes = db.relationship('Dish', secondary=restaurant_dish, backref=db.backref('restaurants'))