Bug #106925 Migration wizard fails on 'Migrate selected objects' step
Submitted: 6 Apr 2022 9:33 Modified: 27 Apr 2022 12:16
Reporter: Sander Bouwhuis Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S2 (Serious)
Version:v8.0.28 OS:Windows (Win 10 Pro x64)
Assigned to: CPU Architecture:x86 (64-bit)

[6 Apr 2022 9:33] Sander Bouwhuis
Description:
I'm trying to migrate a database from Sql Server to MySql, but the migration wizard fails on the step where it says : "Migrate selected objects".

Here is the error:

Starting...
Migrate Selected Objects....

Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 8.0\workbench\wizard_progress_page_widget.py", line 197, in thread_work
    self.func()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\migration_object_migration.py", line 117, in task_migrate
    self.main.plan.migrate()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\migration.py", line 510, in migrate
    self.migrationTarget.catalog = self.migrationSource.migration.migrateCatalog(self.state, self.migrationSource.catalog)
SystemError: AttributeError("module 'string' has no attribute 'maketrans'"): error calling Python module function DbMssqlMigration.migrateCatalog
ERROR: Migrate Selected Objects: AttributeError("module 'string' has no attribute 'maketrans'"): error calling Python module function DbMssqlMigration.migrateCatalog
Failed

How to repeat:
Try to migrate a Sql Server database to MySql
[6 Apr 2022 9:44] Sander Bouwhuis
I found a fix.

You need to change line 148 in this file:
MySQL\MySQL Workbench 8.0\modules\db_mssql_migration_grt.py

FROM
mysql_name = mysql_name.translate(string.maketrans(r'/\.', '___'))

TO
mysql_name = mysql_name.translate(str.maketrans(r'/\.', '___'))

After that, it works.
[6 Apr 2022 12:17] MySQL Verification Team
Hello Sander Bouwhuis,

Thank you for the bug report and feedback.
I tried to reproduce your issue on Windows 10 with MySQL Workbench 8.0.28 and migrated database objects from mssql to mysql but I am not seeing any issues at my end. 
Could you please provide create table SQL statement for SQL Server which fails to be migrated?

Regards,
Ashwini Patil
[6 Apr 2022 17:46] Sander Bouwhuis
The bug has to do with a deprecated Python function:

From the Python documentation:
https://docs.python.org/3/library/stdtypes.html?highlight=maketrans#str.maketrans

string.maketrans can't be used anymore. You have to use str.maketrans
[7 Apr 2022 11:33] MySQL Verification Team
Hello Sander Bouwhuis,

Thank you for the feedback.
Yes, string.maketrans is not available anymore in python 3.x but I am not able to reproduce this issue using test db at my end.
If you can provide a sample db, I can try and reproduce the issue.

Regards,
Ashwini Patil
[7 Apr 2022 19:33] Sander Bouwhuis
Dear Ashwini,

That means you probably use an outdated version of Python (verion 2)? Python 3 was released in 2008 (14 years ago).
If MySql Workbench is dependant on an outdated version of Python, then you should ship MySql Workbench with Python 2.
[27 Apr 2022 12:13] MySQL Verification Team
Proof that I am using Python 3

Attachment: 106925_python3.PNG (image/png, text), 14.75 KiB.

[27 Apr 2022 12:16] MySQL Verification Team
Hello Sander Bouwhuis,

Thank you for the feedback.
I tried again to reproduce your issue on windows 10 with MySQL Workbench 8.0.28 and migrated sample database but I am not seeing any issues at my end.
Please see the attachment.

Regards,
Ashwini Patil
[27 Apr 2022 12:17] MySQL Verification Team
8.0.28 test results

Attachment: 106925_test_results.PNG (image/png, text), 196.60 KiB.

[14 Jun 2022 2:37] Abdulaziz Fayez
Im on Windows 11 and using Mysql workbench 8.0.29 (latest as of now), and i have the same similar issue.

I am migrating MS SQL Server to Mysql and on select migration option, i am not able to select objects at "migrate table objects" for individual tables. 

Only Select ALL in or ALL out works.

Please advise.
[10 Jul 2023 9:26] Michal Michal
Hi,

I have experienced the same issue as notified. I tried to migrate from Microsoft SQL Server.

Win 11
Python 3.7

I send screenshots.
[10 Jul 2023 9:26] Michal Michal
Error

Attachment: Screenshot 2023-07-10 11.19.00.png (image/png, text), 306.65 KiB.

[10 Jul 2023 9:27] Michal Michal
Python ver.

Attachment: Screenshot 2023-07-10 11.22.08.png (image/png, text), 250.36 KiB.

[10 Jul 2023 9:47] Michal Michal
Python 3.9.0

Attachment: Screenshot 2023-07-10 11.46.31.png (image/png, text), 215.72 KiB.