I am connecting to mysql database via mysql connector and running a simple query to pull a list of IDs. I need to loop over that list and pass them into some other code. For
Yes, this is expected behavior. Using the cursor as an iterable is basically equivalent to looping over it using the fetchone()
method. From the documentation for fetchone() (emphasis mine):
This method retrieves the next row of a query result set and returns a single sequence, or None if no more rows are available. By default, the returned tuple consists of data returned by the MySQL server, converted to Python objects. If the cursor is a raw cursor, no such conversion occurs;