Level 58
To get the values one by one in a for loop, you can simply iterate over the cursor object instead of fetching all the records at once using fetchall(). Here's the updated code:
query = "SELECT `chatid` FROM `chats`"
cursor = await self.db.execute(query)
for i in cursor:
print(i[0])
This will print the values one by one in the for loop. Note that the values are accessed using i[0] since the cursor returns a tuple for each record, and we only want the first element of the tuple which contains the chatid value.