apache/seatunnel · error · CatalogException

Failed getting table %s

Error message

Failed getting table %s

What it means

Generic wrapper in SapHanaCatalog.getTable(): after the synonym resolution step, any Exception raised while reading metadata (primary keys, constraint keys, columns) and building the CatalogTable is rethrown as CatalogException 'Failed getting table <fullName>'. SeaTunnelRuntimeException is rethrown unchanged. This error means metadata extraction for an existing table failed — the table exists but its schema could not be read.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/saphana/SapHanaCatalog.java:261

                TableSchema.Builder builder = TableSchema.builder();
                buildColumnsWithErrorCheck(tablePath, resultSet, builder);
                // add primary key
                primaryKey.ifPresent(builder::primaryKey);
                // add constraint key
                constraintKeys.forEach(builder::constraintKey);
                TableIdentifier tableIdentifier = getTableIdentifier(originalTablePath);
                return CatalogTable.of(
                        tableIdentifier,
                        builder.build(),
                        buildConnectorOptions(tablePath),
                        Collections.emptyList(),
                        "",
                        catalogName);
            }
        } catch (SeaTunnelRuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new CatalogException(
                    String.format("Failed getting table %s", tablePath.getFullName()), e);
        }
    }

    @Override
    protected Column buildColumn(ResultSet resultSet) throws SQLException {
        String columnName = resultSet.getString("COLUMN_NAME");
        String typeName = resultSet.getString("DATA_TYPE_NAME");
        Long columnLength = resultSet.getLong("LENGTH");
        Integer columnScale = resultSet.getObject("SCALE", Integer.class);
        String fullTypeName = appendColumnSizeIfNeed(typeName, columnLength, columnScale);
        String columnComment = resultSet.getString("COMMENTS");
        Object defaultValue = resultSet.getObject("DEFAULT_VALUE");
        boolean isNullable = resultSet.getString("IS_NULLABLE").equals("TRUE");

        if (typeName.equalsIgnoreCase("ARRAY")) {
            fullTypeName =
                    appendColumnSizeIfNeed(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the cause chain — the wrapped SQLException/RuntimeException names the failing metadata call or column.
  2. Check user privileges on the target schema for metadata queries (TABLES, COLUMNS, constraints views).
  3. Look for HANA-specific column types that the JdbcColumnConverter cannot map and cast or alter them.
  4. Retry in case of transient connection failures, or increase connection/metadata timeout settings.

Example fix

// before
CatalogTable t = catalog.getTable(TablePath.of("MYDB", "ORDERS"));
// after
try {
    CatalogTable t = catalog.getTable(TablePath.of("MYDB", "ORDERS"));
} catch (CatalogException e) {
    LOG.error("metadata read failed for ORDERS", e.getCause());
    throw e;
}
Defensive patterns

Strategy: try-catch

Try / catch

// java
try {
    CatalogTable t = catalog.getTable(tablePath);
} catch (CatalogException e) {
    Throwable c = e.getCause();
    LOG.error("failed reading metadata for {}: {}", tablePath.getFullName(), c.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: getPrimaryKey, getConstraintKeys, or the columns query throws (SQL error, unsupported column type in buildColumn, connection dropped), or CatalogTable construction fails after the table was confirmed to exist.

Common situations: Table contains a data type the converter cannot map (falls into buildColumn errors); the querying user lacks metadata privileges on the schema; JDBC driver returns unexpected metadata for HANA-specific types; connection timeout during metadata reads.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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