<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def iter(self, query, *parameters, **kwargs):
 """Returns a generator for records from the query."""

        cursor = self._cursor()
        try:
            self._execute(cursor, query, parameters or None, kwargs)
            if cursor.description:
                column_names = [column.name for column in cursor.description]
                while True:
                    record = cursor.fetchone()
                    if not record:
                        break
                    yield Row(zip(column_names, record))
            raise StopIteration

        except:
            cursor.close()
            raise