【问题标题】:MySQL workbench migration wizard erre "not supported between instances of 'int' and 'NoneType"MySQL 工作台迁移向导错误“'int' 和 'NoneType 的实例之间不支持”
【发布时间】:2021-05-12 04:13:54
【问题描述】:

我正在尝试使用 MySQL 工作台迁移向导 beetwen postgresql 和我的 sql,但是在迁移步骤中我有这个错误:

    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

我该如何解决?

【问题讨论】:

  • 对此@Ali的任何解决方案

标签: linux mysql-workbench


【解决方案1】:

可以在此处找到解决方案:https://bugs.mysql.com/bug.php?id=102532。不确定 MySQL 开发人员是否打算重新打开此错误报告,因此您可能需要自己修复此问题。

具体来说,我终于在db_generic_migration_grt.py 中将问题追溯到这一行。我的堆栈跟踪如下:

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

所有有问题的列都具有text 类型并且是主键。我相信这与 StackOverflow 讨论有关:MySQL error: key specification without a key length

我通过在上面的 Python 文件中捕获错误并在这些情况下将 MYSQL_MAX_INDEX_KEY_LENGTH_INNODB_UTF8 分配为 prefix_length_limit 来解决了这个问题。不漂亮,但它很有效,所以我可以迁移数据。

【讨论】:

    猜你喜欢
    • 2020-06-02
    • 2019-08-14
    • 2021-10-22
    • 2022-01-20
    • 2017-09-28
    • 1970-01-01
    • 1970-01-01
    • 2020-02-12
    • 1970-01-01
    相关资源
    最近更新 更多