I have query using SQLAlchemy ORM:
query_category = DBSession.query(Product) \
.options(defer(Product.stock_qty))\
.filter(
Product.categories.any(Category.id == category.id),
Product.categories.any(Category.id.in_(parent_ids)),
)
I want to iterate this query in loop twice using for .. in like this:
for i in query_category:
...do something
for i in query_category:
...do something else
I understand that this is generator, but i don't know how to 'restart' this generator. I am try to use seek(0)
like with file, but it is not work. So what command should i use for restart
my query