apache/seatunnel · warning
Failed to query table schema: {}
Error message
Failed to query table schema: {} What it means
Logged by DatabendSinkWriter.queryTableSchema() when querying Databend's information/schema for the target table's columns throws any exception. The method returns null on failure, and callers fall back to schema inference. Because this is a warn (not throw), a transient query failure silently degrades the writer to inferred column names.
Source
Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/sink/DatabendSinkWriter.java:584
while (rs.next()) {
String columnName = rs.getString("Field");
String columnType = rs.getString("Type");
fieldNames.add(columnName);
fieldTypes.add(convertDatabendTypeNameToSeaTunnelType(columnType));
log.info("Found column: {} {}", columnName, columnType);
}
if (!fieldNames.isEmpty()) {
return new SeaTunnelRowType(
fieldNames.toArray(new String[0]),
fieldTypes.toArray(new SeaTunnelDataType<?>[0]));
}
}
} catch (Exception e) {
log.warn("Failed to query table schema: {}", e.getMessage());
}
return null;
}
private SeaTunnelDataType<?> convertDatabendTypeNameToSeaTunnelType(String typeName) {
if (typeName == null) {
return BasicType.STRING_TYPE;
}
typeName = typeName.toUpperCase();
if (typeName.contains("VARCHAR")
|| typeName.contains("STRING")
|| typeName.contains("TEXT")) {
return BasicType.STRING_TYPE;
} else if (typeName.contains("INT") && !typeName.contains("BIGINT")) {
return BasicType.INT_TYPE;
} else if (typeName.contains("BIGINT")) {View on GitHub (pinned to cf67b549a7)
Solutions
- Verify the configured database/table names are correct and the table exists before starting the job
- Grant the Databend user permission to read information_schema / describe the table
- Ensure the JDBC connection URL and credentials are valid; test with a manual DESC table
- Check the logged exception message for the root SQL error (only e.getMessage() is logged) and fix accordingly
Example fix
// before
} catch (Exception e) {
log.warn("Failed to query table schema: {}", e.getMessage());
}
// after
} catch (Exception e) {
log.warn("Failed to query table schema: {}", e.getMessage(), e);
throw new DatabendConnectorException(DatabendConnectorErrorCode.SCHEMA_NOT_FOUND, e);
} Defensive patterns
Strategy: fallback
Validate before calling
// pre-check metadata access before running the job
try (Connection c = DriverManager.getConnection(url, user, pass);
Statement s = c.createStatement()) {
s.executeQuery("DESC " + database + "." + table);
} Type guard
boolean schemaQueryable(String db, String tbl) {
try (Connection c = DriverManager.getConnection(url, user, pass);
Statement s = c.createStatement()) {
s.executeQuery("SELECT 1 FROM information_schema.tables WHERE table_schema='" + db + "' AND table_name='" + tbl + "' AND 1=0");
return true;
} catch (SQLException e) { return false; }
} Try / catch
try {
SeaTunnelRowType t = queryTableSchema();
} catch (Exception e) {
// writer already returns null; provide explicit schema instead of relying on inference
} Prevention
- Pre-create the target table or ensure auto-create completes before schema lookup
- Grant metadata privileges to the sink user
- Validate database/table names in config before job submission
When it happens
Trigger: The JDBC metadata query (e.g. DESC/information_schema.columns) fails: bad connection, missing SELECT privilege on information_schema, wrong database/table name, or table not yet created (auto-create race).
Common situations: Typo in table/database name; user lacks metadata privileges; auto_create_table enabled so the table doesn't exist yet at first schema lookup; network error to Databend.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- SQL_OPERATION_FAILED
- Failed to read schema for table %s
- Error reading default database charsets: ${e.getMessage()}
- Failed to read schema for table ${tableId}
- Failed to read schema for table ${tableId}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/41249f89abf0432a.
Report an issue: GitHub.