apache/seatunnel · warning
table {} not exist when get the database catalog table
Error message
table {} not exist when get the database catalog table What it means
getDatabaseTableSchema looks up the target table through the connector's catalog to fetch its schema and logs a WARN, returning Optional.empty(), when the catalog reports TableNotExistException. The writer then proceeds without DB-side schema info (e.g. auto-generated column handling), which can cause wrong column bindings downstream.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSink.java:209
private Optional<TableSchema> getDatabaseTableSchema() {
Optional<Catalog> catalogOptional = getCatalog();
FieldIdeEnum fieldIdeEnumEnum = config.get(JdbcSinkOptions.FIELD_IDE);
String fieldIde =
fieldIdeEnumEnum == null
? FieldIdeEnum.ORIGINAL.getValue()
: fieldIdeEnumEnum.getValue();
TablePath tablePath =
TablePath.of(
catalogTable.getTableId().getDatabaseName(),
catalogTable.getTableId().getSchemaName(),
CatalogUtils.quoteTableIdentifier(
catalogTable.getTableId().getTableName(), fieldIde));
if (catalogOptional.isPresent()) {
try (Catalog catalog = catalogOptional.get()) {
catalog.open();
return Optional.of(catalog.getTable(tablePath).getTableSchema());
} catch (TableNotExistException e) {
log.warn("table {} not exist when get the database catalog table", tablePath);
return Optional.empty();
}
}
return Optional.empty();
}
@Override
public Optional<SinkAggregatedCommitter<XidInfo, JdbcAggregatedCommitInfo>>
createAggregatedCommitter() {
// Load the JDBC driver in to DriverManager
try {
Class.forName(jdbcSinkConfig.getJdbcConnectionConfig().getDriverName());
} catch (Exception e) {
log.warn(
"Failed to load JDBC driver {}",
jdbcSinkConfig.getJdbcConnectionConfig().getDriverName(),
e);
}View on GitHub (pinned to cf67b549a7)
Solutions
- Create the sink table in the target database or enable the auto-create-table (schema_save_mode = CREATE_SCHEMA_WHEN_NOT_EXIST) option
- Fix database/table names in the sink config to match actual DB identifiers including case
- Verify the catalog URL points at the correct database instance/schema
- Check grants — some catalogs report missing tables when the user cannot see them
Example fix
// before
sink {
Jdbc {
database = "prod"
table = "orders"
}
}
// after: table actually exists or is created automatically
sink {
Jdbc {
schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"
database = "prod"
table = "orders"
}
} Defensive patterns
Strategy: validation
Validate before calling
-- verify table exists before running the job SELECT 1 FROM information_schema.tables WHERE table_schema = 'prod' AND table_name = 'orders';
Try / catch
try {
schema = catalog.getTable(tablePath).getTableSchema();
} catch (TableNotExistException e) {
schema = createTableIfConfigured(tablePath); // schema_save_mode = CREATE_SCHEMA_WHEN_NOT_EXIST
} Prevention
- Enable schema_save_mode = CREATE_SCHEMA_WHEN_NOT_EXIST for sink tables
- Match identifier case to the target DB (quote/uppercase for Postgres/Oracle, lowercase for Postgres defaults)
- Validate database/table names against the live DB before job submission
- Ensure the sink user has enough grants to see and read the table metadata
When it happens
Trigger: createWriter or restoreWriter asks for the sink table's schema while the table (database.table from TablePath) does not exist in the target database, or catalog resolves a different schema/database name than configured.
Common situations: Sink table never created and auto-create is disabled; typo in database/table name; case-sensitivity mismatch (Postgres lowercase vs config uppercase); wrong catalog configured so the lookup hits the wrong DB instance.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Table 'TablePath{databaseName='null', schemaName='null', tab
- Expected Array type but got:
- Failed to read schema for table %s
- 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/e7f674a7b65a5c87.
Report an issue: GitHub.