如何解决oceanbase MySQL数据库逆向解析时,表清单可以正常解析,但是最后一步卡住的问题 ,数据库名称与schema一致

Viewed 59

微信图片_20251110105554_25_3.png

检查下schemaName与数据库中的大小写一致,schemaName是严格区分大小的

1 Answers

修改元数据字段查询模板:

c56039a3-cf2a-488e-941e-7bc48703a352.png

修改为:

SELECT
    table_schema as schema_name,
    table_name AS tbl_def_key,
    ordinal_position as order_value,
    column_name AS def_key,
    column_comment AS def_name,
    '' AS intro,
    data_type AS db_data_type,
    IF(data_type = column_type or data_type = 'decimal', IF(data_type = 'decimal', CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(COLUMN_TYPE, '(', -1), ',', 1) AS UNSIGNED), NULL),character_maximum_length) AS data_len,
    IF(data_type = column_type or data_type = 'decimal', IF(data_type = 'decimal', CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(COLUMN_TYPE, ',', -1), ')', 1) AS UNSIGNED), NULL), numeric_scale ) AS num_scale,
    IF(column_key = 'PRI', 1, 0 ) AS primary_key,
    IF(is_nullable = 'YES', 0, 1 ) AS not_null,
    IF(extra = 'AUTO_INCREMENT', 1, 0 ) AS auto_increment,
    column_default AS default_value
FROM
    information_schema.COLUMNS
WHERE
    table_schema in (:schemaName)
  and CONCAT(table_schema, '.', table_name) in (:sysTableNames)
ORDER BY
    table_schema ASC,
    table_name ASC,
    ordinal_position ASC