Bug #92659 Schema Migration Fails from MSSQL to MySQL
Submitted: 3 Oct 2018 16:46 Modified: 10 Dec 2018 21:36
Reporter: Hamza Ahmed Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S3 (Non-critical)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any

[3 Oct 2018 16:46] Hamza Ahmed
Description:
Migration from MS SQL Server 2008 to MySQL 5.7.12 fails during the Reverse Engineer Source phase.

A lot of tables are retrieved, but it fails on one of the tables, the messages in error log are as below:

- Retrieving table dbo.ParcelZoningLookup_...
- Retrieving table dbo.'2015BrookfieldCityUpdate_121115'...
Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_mssql_grt.py", line 395, in reverseEngineer
    reverseEngineerTables(connection, schema)
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_mssql_grt.py", line 568, in reverseEngineerTables
    reverseEngineerTablePK(connection, table)
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_mssql_grt.py", line 704, in reverseEngineerTablePK
    pk_col_names = [ row[3] for row in execute_query(connection, query) ]
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_mssql_grt.py", line 66, in execute_query
    return get_connection(connection_object).cursor().execute(query, *args, **kwargs)
pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '2015'. (102) (SQLExecDirectW)")

Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\workbench\wizard_progress_page_widget.py", line 196, in thread_work
    self.func()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\migration_schema_selection.py", line 179, in task_reveng
    self.main.plan.migrationSource.reverseEngineer()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\migration.py", line 364, in reverseEngineer
    self.state.sourceCatalog = self._rev_eng_module.reverseEngineer(self.connection, self.selectedCatalogName, self.selectedSchemataNames, self.state.applicationData)
SystemError: ProgrammingError("('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '2015'. (102) (SQLExecDirectW)")"): error calling Python module function DbMssqlRE.reverseEngineer
ERROR: Reverse engineer selected schemas: ProgrammingError("('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '2015'. (102) (SQLExecDirectW)")"): error calling Python module function DbMssqlRE.reverseEngineer
Failed

How to repeat:
Restart the migration.
[4 Oct 2018 8:53] MySQL Verification Team
Please provide a create table sql statement for SQL Server which fails to be migrated. Thanks in advance.
[4 Oct 2018 15:51] Hamza Ahmed
The create table statement is as below:

CREATE TABLE [dbo].['2015BrookfieldCityUpdate_121115'](
	[YEAR_] [float] NULL,
	[Name] [nvarchar](255) NULL,
	[POP] [float] NULL,
	[POPCHNG] [float] NULL,
	[HOUSING] [float] NULL,
	[JOBS] [float] NULL,
	[JOBCHNG] [float] NULL,
	[PCTCHNG] [float] NULL,
	[HSNG2JOB] [float] NULL,
	[JOB2HSNG] [float] NULL,
	[AFFDBLTY] [float] NULL,
	[PERMITS] [float] NULL,
	[MEDPRICE] [float] NULL,
	[REL_ID] [nvarchar](255) NULL,
	[GEOID] [float] NULL
) ON [SECONDARY]
[4 Oct 2018 17:10] MySQL Verification Team
Thank you for the feedback.
[10 Dec 2018 21:36] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 8.0.14 release, and here's the changelog entry:

The operation to migrate a Microsoft SQL Server schema produced an error
when it encountered some tables during the reverse-engineering step.

Thank you for the bug report.