apache/seatunnel · error · SeaTunnelException
Can't obtain schema for table %s
Error message
Can't obtain schema for table %s
What it means
After querying, readTableSchema found no TableChange cached for the requested TableId — the schema lookup completed without error but the table's schema is absent. SqlServerSchema throws SeaTunnelException because it cannot build a SourceReader without column definitions.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/utils/SqlServerSchema.java:88
false);
for (TableId id : tables.tableIds()) {
if (tableMap.containsKey(id)) {
Table table =
CatalogTableUtils.mergeCatalogTableConfig(
tables.forTable(id), tableMap.get(id));
TableChanges.TableChange tableChange =
new TableChanges.TableChange(
TableChanges.TableChangeType.CREATE, table);
schemasByTableId.put(id, tableChange);
}
}
} catch (SQLException e) {
throw new SeaTunnelException(
String.format("Failed to read schema for table %s ", tableId), e);
}
if (!schemasByTableId.containsKey(tableId)) {
throw new SeaTunnelException(
String.format("Can't obtain schema for table %s ", tableId));
}
return schemasByTableId.get(tableId);
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Verify the fully-qualified table name (database.schema.table) matches exactly, including case, in the connector config
- Connect with credentials that can see the table's metadata in the target database
- Query SQL Server directly (SELECT ... FROM INFORMATION_SCHEMA.TABLES / sys.tables) to confirm the table is visible
- Ensure database.server/database name in config points to the DB containing the table
Example fix
// before table-names = ["dbo.Orders"] // wrong DB or schema // after table-names = ["MyDB.sales.Orders"] // fully qualified, exact case
Defensive patterns
Strategy: validation
Validate before calling
// Verify exact table visibility before running SELECT s.name + '.' + t.name AS fqn FROM sys.tables t JOIN sys.schemas s ON t.schema_id = s.schema_id WHERE s.name + '.' + t.name = 'dbo.Orders'; -- must return exactly one row matching the config value
Prevention
- Use fully-qualified, exact-case database.schema.table in table-names
- Confirm the login can see the table's metadata ( INFORMATION_SCHEMA / sys.tables)
- Do not drop tables while the job is starting
- Point the connection at the database that actually contains the table
When it happens
Trigger: getTableSchema → readTableSchema: schemasByTableId does not contain the tableId after the metadata query — the table was not returned by the database metadata (does not exist, wrong database/schema, or name case mismatch).
Common situations: Typo or wrong case in database.schema.table config; table exists in a different database than the one connected to; table dropped between config and runtime; using synonyms or views that the metadata query does not resolve.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Can't obtain schema for table %s
- Unable to find table in relational model: <tableId>
- Unable to find table in relational model: ${tableId}
- Failed to read schema for table %s
- Unsupported alter table event:
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/50688a8cd6bd2fd7.
Report an issue: GitHub.