Sep-26-2022, 09:26 PM
cursor.fetchall() will return all responses to the "execute" as a list. For your particular need it might be valid to use curser.fetchone().
If there are multiple responses you could also use cursor.execute(sql, params) as an iterator.
If there are multiple responses you could also use cursor.execute(sql, params) as an iterator.
for reply in cursor.execute(sql, params): print(reply)This last is a lazy iterator. It retrieves replies one at a time. That can be useful for some kinds of queries.