'MySQL workbench migration wizard erre "not supported between instances of 'int' and 'NoneType"
I'm trying to use MySQL workbench migration wizard beetwen postgresql and my sql, But in migration step i have this error:
Traceback (most recent call last):
File "/usr/share/mysql-workbench/libraries/workbench/wizard_progress_page_widget.py", line 197, in thread_work
self.func()
File "/usr/lib/mysql-workbench/modules/migration_object_migration.py", line 117, in task_migrate
self.main.plan.migrate()
File "/usr/lib/mysql-workbench/modules/migration.py", line 510, in migrate
self.migrationTarget.catalog = self.migrationSource.migration.migrateCatalog(self.state, self.migrationSource.catalog)
SystemError: TypeError("'<=' not supported between instances of 'int' and 'NoneType'"): error calling Python module function DbPostgresqlMigration.migrateCatalog
ERROR: Migrate Selected Objects: TypeError("'<=' not supported between instances of 'int' and 'NoneType'"): error calling Python module function DbPostgresqlMigration.migrateCatalog
Failed
How I can fix it?
Solution 1:[1]
The solution can be found here: https://bugs.mysql.com/bug.php?id=102532. Not sure if the MySQL devs intend to reopen this bug report, so you'll want to probably fix this yourself.
Specifically, I finally tracked the problem down to this line in db_generic_migration_grt.py. My stack trace is below:
Traceback:
File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_postgresql_migration_grt.py", line 313, in migrateCatalog
return instance.migrateCatalog(state, source_catalog)
File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_generic_migration_grt.py", line 182, in migrateCatalog
targetSchema = self.migrateSchema(state, sourceSchema, target_catalog)
File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_generic_migration_grt.py", line 218, in migrateSchema
self.migrateSchemaContents(state, targetSchema, sourceSchema)
File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_generic_migration_grt.py", line 234, in migrateSchemaContents
target_table = self.migrateTableToMySQL(state, source_table, targetSchema)
File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_sql92_migration_grt.py", line 36, in migrateTableToMySQL
targetTable = super(Sql92Migration, self).migrateTableToMySQL(state, sourceTable, targetSchema)
File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_generic_migration_grt.py", line 285, in migrateTableToMySQL
targetIndex = self.migrateTableIndexToMySQL(state, sourceIndex, targetTable)
File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\db_generic_migration_grt.py", line 424, in migrateTableIndexToMySQL
prefix_length_limit = min(referenced_index_col.length, MYSQL_MAX_INDEX_KEY_LENGTH_INNODB_UTF8) if referenced_index_col.length > 0 else MYSQL_MAX_INDEX_KEY_LENGTH_INNODB_UTF8
NameError: '>' not supported between instances of 'NoneType' and 'int'
00:43:23 [ERR][ Wizard]: Thread 'Migrate Selected Objects' failed: TypeError("'>' not supported between instances of 'NoneType' and 'int'"): error calling Python module function DbPostgresqlMigration.migrateCatalog
All of the offending columns have had the text type and were primary keys. I believe this is related to this StackOverflow discussion: MySQL error: key specification without a key length.
I fixed the problem by catching the errors in the Python file above and assigning MYSQL_MAX_INDEX_KEY_LENGTH_INNODB_UTF8 as the prefix_length_limit in those cases. Not pretty, but it worked so I could migrate the data over.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MitaHast |
