Answer the question
In order to leave comments, you need to log in
How to get from the database all rows in Gino whose id matches one of the values in the list using async for?
I need to get from the database all the lines whose id matches one of the values in the initially given list. The list can be quite large, so sending queries sequentially to the database is a bad option. For this reason, I need to use
async for Table.select('ids').where(Table.id in spisok).gino.iterate():
asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Answer the question
In order to leave comments, you need to log in
Found the method Table.id.in_(spisok)
Everything works well. So the question now boils down to just this
In general, I need to get from the table all the values of the ids column in those rows in which the id matches one of the values of the spisok list, then form a new list from the obtained ids values and repeat the operation for it.
If somehow it was possible to ask the database to do such iterations with one request, this would be the best way out in my situation, but I can’t find such examples.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question