Database migration from Sybase to MySQL: " error calling Python module function DbSQLAnywhereRE.reverseEngineer"
<p>I'm trying to migrate a database from <a href="https://en.wikipedia.org/wiki/Sybase" rel="nofollow">Sybase</a> to <a href="http://en.wikipedia.org/wiki/MySQL" rel="nofollow">MySQL</a> with the <a href="https://en.wikipedia.org/wiki/MySQL_Workbench" rel="nofollow">MySQL Workbench</a> migration tool.</p>

<p>I have no problem connecting the datasource and the target database, but when it starts migrating I get the following issue from the log message.</p>

<blockquote>
  <p>Starting...<br>
  Connect to source DBMS...<br>
  - Connecting...<br>
  Connect to source DBMS done<br>
  Reverse engineer selected schemas....<br>
  Reverse engineering DBA, SYS, dbo, rs_systabgroup from corsi<br>
  - Reverse engineering catalog information<br>
  - Preparing...<br>
  Traceback (most recent call last):<br>
    File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.3 <br>CE\modules\db_sqlanywhere_re_grt.py", line 489, in reverseEngineer<br>
      return SQLAnywhereReverseEngineering.reverseEngineer(connection, catalog_name, schemata_list, context)<br>
    File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.3 CE\modules\db_sqlanywhere_re_grt.py", line 169, in reverseEngineer
      catalog = super(SQLAnywhereReverseEngineering, cls).reverseEngineer(connection, '', schemata_list, context)<br>
    File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.3 CE\modules\db_generic_re_grt.py", line 258, in reverseEngineer
      table_count_per_schema[schema_name] = len(cls.getTableNames(connection, catalog_name, schema_name)) if get_tables else 0<br>
    File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.3 CE\modules\db_sqlanywhere_re_grt.py", line 41, in wrapped_method
      res = method(cls, connection, *args)<br>
    File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.3 CE\modules\db_sqlanywhere_re_grt.py", line 145, in getTableNames
      return [row[0] for row in cls.execute_query(connection, query)]<br>
    File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.3 CE\modules\db_generic_re_grt.py", line 76, in execute_query
      return cls.get_connection(connection_object).cursor().execute(query, *args, **kwargs)
  pyodbc.ProgrammingError: ('42S02', "[42S02] [Sybase][ODBC Driver][Adaptive Server Anywhere]Table or view not found: Table 'SYSTAB' not found (-141) (SQLExecDirectW)")<br></p>
  
  <p>Traceback (most recent call last):<br>   File "C:\Program Files
  (x86)\MySQL\MySQL Workbench 6.3
  CE\workbench\wizard_progress_page_widget.py", line 192, in thread_work
      self.func()<br>   File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.3 CE\modules\migration_schema_selection.py", line 175, in
  task_reveng
      self.main.plan.migrationSource.reverseEngineer()<br>   File "C:\Program Files (x86)\MySQL\MySQL Workbench 6.3
  CE\modules\migration.py", line 369, in reverseEngineer
      self.state.sourceCatalog = self._rev_eng_module.reverseEngineer(self.connection,
  self.selectedCatalogName, self.selectedSchemataNames,
  self.state.applicationData) SystemError: ProgrammingError("('42S02',
  "[42S02] [Sybase][ODBC Driver][Adaptive Server Anywhere]Table or view
  not found: Table 'SYSTAB' not found (-141) (SQLExecDirectW)")"): error
  calling Python module function DbSQLAnywhereRE.reverseEngineer<br>
  ERROR: Reverse engineer selected schemas: ProgrammingError("('42S02',
  "[42S02] [Sybase][ODBC Driver][Adaptive Server Anywhere]Table or view
  not found: Table 'SYSTAB' not found (-141) (SQLExecDirectW)")"): error
  calling Python module function DbSQLAnywhereRE.reverseEngineer<br>
  Failed</p>
</blockquote>

<p>How do I solve this issue?</p>

<p>That's because of SQL to get table names. Look at db_sqlanywhere_re_grt.py:142, there is:</p>

<pre><code>SELECT st.table_name
FROM SYSTAB st LEFT JOIN SYSUSER su ON st.creator=su.user_id
WHERE su.user_name = '%s' AND st.table_type = 1
</code></pre>

<p>This is valid sql for sql anywhere version &lt; 10, and I guess you have newest version. So you can edit and update that file with compatible SQL. 
Keep in mind there is much more SQL's that also need to be updated in that file.
In meantime, please fill the bug report at <a href="http://bugs.mysql.com" rel="nofollow">bugs.mysql.com</a>.</p>

python mysql mysql-workbench database-migration