techouse / mysql-to-sqlite3

Transfer data from MySQL to SQLite
https://techouse.github.io/mysql-to-sqlite3/
MIT License
221 stars 31 forks source link

Cannot import name 'ToPythonOutputTypes' from 'mysql.connector.types' #65

Closed makeevolution closed 10 months ago

makeevolution commented 10 months ago

Describe the bug After downloading the package using pip and running it mysql2sqlite --version, I get the exception

Traceback (most recent call last):
  File "/usr/local/bin/mysql2sqlite", line 5, in <module>
    from mysql_to_sqlite3.cli import cli
  File "/usr/local/lib/python3.9/site-packages/mysql_to_sqlite3/__init__.py", line 4, in <module>
    from .transporter import MySQLtoSQLite
  File "/usr/local/lib/python3.9/site-packages/mysql_to_sqlite3/transporter.py", line 18, in <module>      
    from mysql.connector.types import ToPythonOutputTypes
ImportError: cannot import name 'ToPythonOutputTypes' from 'mysql.connector.types' (/usr/local/lib/python3.9/site-packages/mysql/connector/types.py)

I googled around but couldn't find anyone with similar issue. Also tried with python3.11 but no dice

Expected behaviour The version

Actual result The above exception

System Information

python3.9
Red Hat Enterprise Linux 8.9 (Ootpa)
techouse commented 10 months ago

Hi,

Can you please follow the bug issue template's instructions and paste the whole output of --version?

makeevolution commented 10 months ago

Hi,

Running mysql2sqlite --version gives me the traceback

Traceback (most recent call last):
  File "/usr/local/bin/mysql2sqlite", line 5, in <module>
    from mysql_to_sqlite3.cli import cli
  File "/usr/local/lib/python3.9/site-packages/mysql_to_sqlite3/__init__.py", line 4, in <module>
    from .transporter import MySQLtoSQLite
  File "/usr/local/lib/python3.9/site-packages/mysql_to_sqlite3/transporter.py", line 18, in <module>      
    from mysql.connector.types import ToPythonOutputTypes
ImportError: cannot import name 'ToPythonOutputTypes' from 'mysql.connector.types' (/usr/local/lib/python3.9/site-packages/mysql/connector/types.py)
techouse commented 10 months ago

It looks like this constant got removed in MySQL Connector/Python v8.3.0. I'll push a fix shortly, meanwhile, you can downgrade it to 8.2.0 and it will work.

techouse commented 10 months ago

Fixed in v2.1.9.

Thanks again for the bug report! ♥️