{"record":{"id":"c287af70b37bc927","repo":"apache/seatunnel","slug":"failed-to-read-table-metadata-from-information-sch","errorCode":null,"errorMessage":"Failed to read table metadata from information_schema for {}.{}: {}","messagePattern":"Failed to read table metadata from information_schema for (.+?)\\.(.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/mysql/MySqlCatalog.java","lineNumber":211,"sourceCode":"            String database, String tableName, Map<String, String> options) {\n        String url = getUrlFromDatabaseName(database);\n        String sql = String.format(SELECT_TABLE_META_SQL, database, tableName);\n        try (PreparedStatement ps = getConnection(url).prepareStatement(sql);\n                ResultSet rs = ps.executeQuery()) {\n            if (rs.next()) {\n                String engine = rs.getString(\"ENGINE\");\n                if (StringUtils.isNotBlank(engine)) {\n                    options.put(TABLE_OPTION_ENGINE, engine);\n                }\n                String collation = rs.getString(\"TABLE_COLLATION\");\n                if (StringUtils.isNotBlank(collation)) {\n                    options.put(TABLE_OPTION_COLLATE, collation);\n                    String charset = collation.split(\"_\")[0];\n                    options.put(TABLE_OPTION_CHARSET, charset);\n                }\n            }\n        } catch (SQLException e) {\n            log.warn(\n                    \"Failed to read table metadata from information_schema for {}.{}: {}\",\n                    database,\n                    tableName,\n                    e.getMessage());\n        }\n    }\n\n    @Override\n    protected Column buildColumn(ResultSet resultSet) throws SQLException {\n        String columnName = resultSet.getString(\"COLUMN_NAME\");\n        // e.g. tinyint(1) unsigned\n        String columnType = resultSet.getString(\"COLUMN_TYPE\");\n        // e.g. tinyint\n        String dataType = resultSet.getString(\"DATA_TYPE\").toUpperCase();\n        String comment = resultSet.getString(\"COLUMN_COMMENT\");\n        Object defaultValue = resultSet.getObject(\"COLUMN_DEFAULT\");\n        String isNullableStr = resultSet.getString(\"IS_NULLABLE\");\n        boolean isNullable = isNullableStr.equals(\"YES\");","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/mysql/MySqlCatalog.java#L193-L229","documentation":"MySqlCatalog.readAndFillTableMetaOptions() enriches table options (charset/collation) by querying MySQL's information_schema. When that query throws SQLException, the catalog logs this warning and returns partial metadata without charset/collation options instead of failing getTable(). The table schema itself is still returned.","triggerScenarios":"getTable() on a MySQL catalog where the information_schema query for table collation fails — e.g., permissions deny access to information_schema.TABLES, the table was dropped concurrently, or the connection is broken.","commonSituations":"Restricted-privilege MySQL users (no metadata access), proxy/managed databases (e.g., some RDS-compatible tiers) restricting information_schema reads, MySQL-compatible services (TiDB, MariaDB variants) with schema differences.","solutions":["Grant the catalog user SELECT on information_schema for the target schema/table.","Check connectivity and that the table still exists when getTable() runs.","Verify the MySQL-compatible service supports the information_schema columns used; upgrade the connector if a dialect fix is needed.","Treat the resulting table options as incomplete; set charset/collation explicitly in sink config if it matters downstream."],"exampleFix":"// before\nCREATE USER 'etl'@'%' IDENTIFIED BY '***';\n// after\nGRANT SELECT ON information_schema.TABLES TO 'etl'@'%';","handlingStrategy":"validation","validationCode":"// Before reading, verify metadata access\nGRANT SELECT ON information_schema.TABLES TO 'etl'@'%';\nSHOW GRANTS FOR 'etl'@'%';","typeGuard":null,"tryCatchPattern":"// Options may be missing after this warning\nMap<String,Object> options = table.getOptions();\nString charset = (String) options.getOrDefault(\"charset\", \"utf8mb4\");","preventionTips":["Grant the catalog user SELECT on information_schema","Test getTable() with the production DB user, not a superuser","Set charset/collation explicitly in sink options if metadata lookup is unreliable"],"tags":["jdbc","mysql","metadata","information-schema","sql"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}