I have a loop processing the output of an MySQLdb queries:
for item in getItems()
. . .
where getResults() is returning the output of a cursor.fetchall().
How can I modify getItems() so it combines the fetchall() returns of several different queries? That is, once the results of the first query are exhausted, I want the loop to begin working on the results of a second query.
If both queries have a similar column structure, you could consider using MySQL to combine the two SQL queries using the UNION keyword.
Otherwise, it may be easier to define getItems as a generator.