apache/seatunnel · warning

Failed to read table metadata from information_schema for {}

Error message

Failed to read table metadata from information_schema for {}.{}: {}

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/mysql/MySqlCatalog.java:211

            String database, String tableName, Map<String, String> options) {
        String url = getUrlFromDatabaseName(database);
        String sql = String.format(SELECT_TABLE_META_SQL, database, tableName);
        try (PreparedStatement ps = getConnection(url).prepareStatement(sql);
                ResultSet rs = ps.executeQuery()) {
            if (rs.next()) {
                String engine = rs.getString("ENGINE");
                if (StringUtils.isNotBlank(engine)) {
                    options.put(TABLE_OPTION_ENGINE, engine);
                }
                String collation = rs.getString("TABLE_COLLATION");
                if (StringUtils.isNotBlank(collation)) {
                    options.put(TABLE_OPTION_COLLATE, collation);
                    String charset = collation.split("_")[0];
                    options.put(TABLE_OPTION_CHARSET, charset);
                }
            }
        } catch (SQLException e) {
            log.warn(
                    "Failed to read table metadata from information_schema for {}.{}: {}",
                    database,
                    tableName,
                    e.getMessage());
        }
    }

    @Override
    protected Column buildColumn(ResultSet resultSet) throws SQLException {
        String columnName = resultSet.getString("COLUMN_NAME");
        // e.g. tinyint(1) unsigned
        String columnType = resultSet.getString("COLUMN_TYPE");
        // e.g. tinyint
        String dataType = resultSet.getString("DATA_TYPE").toUpperCase();
        String comment = resultSet.getString("COLUMN_COMMENT");
        Object defaultValue = resultSet.getObject("COLUMN_DEFAULT");
        String isNullableStr = resultSet.getString("IS_NULLABLE");
        boolean isNullable = isNullableStr.equals("YES");

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Grant the catalog user SELECT on information_schema for the target schema/table.
  2. Check connectivity and that the table still exists when getTable() runs.
  3. Verify the MySQL-compatible service supports the information_schema columns used; upgrade the connector if a dialect fix is needed.
  4. Treat the resulting table options as incomplete; set charset/collation explicitly in sink config if it matters downstream.

Example fix

// before
CREATE USER 'etl'@'%' IDENTIFIED BY '***';
// after
GRANT SELECT ON information_schema.TABLES TO 'etl'@'%';
Defensive patterns

Strategy: validation

Validate before calling

// Before reading, verify metadata access
GRANT SELECT ON information_schema.TABLES TO 'etl'@'%';
SHOW GRANTS FOR 'etl'@'%';

Try / catch

// Options may be missing after this warning
Map<String,Object> options = table.getOptions();
String charset = (String) options.getOrDefault("charset", "utf8mb4");

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/c287af70b37bc927. Report an issue: GitHub.