0

I am trying to write a python script which loads series of sql files in sequential manner.

It works without an issue on my local machine, but as soon as it's executed from within a container it fails.

Affected code

iterator = db_cursor.execute(sql_file.read(), multi=True)
            for res in iterator:
                logger.debug("executing query: [%s], affected %d rows", res, res.rowcount)
            iterator.close()

Error

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/dist-packages/mysql/connector/cursor.py", line 486, in _execute_iter

    result = next(query_iter)

StopIteration


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/migration.py", line 91, in <module>

    for res in iterator:

RuntimeError: generator raised StopIteration

Any suggestion on how to rectify it? Thanks.

EDIT Looks like it's a bug within the library I was using. Noticed that I've been using mysql-connector-python on my local machine and mysql-connector on remote.

Solved now

Alekc
  • 4,682
  • 6
  • 32
  • 35

1 Answers1

0

Looks like it's a bug within the library I was using. Noticed that I've been using mysql-connector-python on my local machine and mysql-connector on remote.

Alekc
  • 4,682
  • 6
  • 32
  • 35