Re: [sqlalchemy] Remove/Filter a query.all() results, add a 'virtual' column

2022-02-21 Thread Cp Divers
Hello Simon, thank you for your help. I've also done more research and tests on my side and here are my solution: 1) remove some item from the list - this was quite easy ! items_to_delete=[] # add all the row/item index that I want to delete for idx,p in enumerate(found): if not

Re: [sqlalchemy] Remove/Filter a query.all() results, add a 'virtual' column

2022-02-21 Thread Simon King
Hi, welcome to Python and SQLAlchemy :-) If you want to do some extra filtering on the results, you can iterate over the results, decide whether each item matches your filter conditions, and if it does, append it to a new list, something like this: filtered_results = [] for part in query.all():

[sqlalchemy] Remove/Filter a query.all() results, add a 'virtual' column

2022-02-20 Thread Cp Divers
Hello Guys, this is my very first post here. I'm not sure this the the right place. I'm a week old with Python and SQLAlchemy. And I believe I'm missing a couple concept, hopefully you can help| I do have this class class BLPart(db.Model): __tablename__ = 'BL_parts' ITEMTYPE =