SQL: How to filter by two lists

Viewed 41

I have a list:

ingredients = [
    {"name": "banana"},
    {"name": "egg"}
]

I have a list of inserted items:

insert_ingredients = ["banana", "egg"]

I want to fullmatch the ingredients list with the last last list. For example, I do not want to fullmatch it:

 ingredients = [
    {"name": "watermelon"},
    {"name": "sugar"}
]

insert_ingredients = ["sugar"]

I just want to fullmatch a entire list with another entire list, how can I do it using Flask SQLAlchemy?

I've tried:

filtered_recipes = base_query.ingredients.filter_by(name=(insert_ingredients)).all()

The result I want is an ingredient list with all inserted ingredients

0 Answers
Related