I have a Query result by Peewee's table.select(), lets say that I want to delete a part of the resulting list(QuerySelect) how is that done? or exclude certain elements from the query?
#Edited
result = users.select();
for element in result:
for name in list:
if(element.name == name):
removeThisElement()
I want to exclude a list of names from the query result
As coleifer said, since you're using peewee, use SQL to do it, so according to your last edit, the solution should be:
result = User.select().where(User.name.not_in(a_list_of_names))
although list comprehension also works:
result = [user for user in Users.select() if user.name not in a_list_of_names]
Documentation: Query.where