apache/seatunnel · error · S3RedshiftJdbcConnectorException

TABLE_SCHEMA_GET_FAILED

TABLE_SCHEMA_GET_FAILED

Error message

Check table is or not existed failed, table name is %s 

What it means

RedshiftJdbcClient.checkTableExists queries DatabaseMetaData.getTables to test table existence. Any SQLException during metadata lookup is wrapped as S3RedshiftJdbcConnectorException(TABLE_SCHEMA_GET_FAILED) with the table name in the message.

Source

Thrown at seatunnel-connectors-v2/connector-s3-redshift/src/main/java/org/apache/seatunnel/connectors/seatunnel/redshift/RedshiftJdbcClient.java:76

        }
        return INSTANCE;
    }

    private RedshiftJdbcClient(String url, String user, String password)
            throws SQLException, ClassNotFoundException {
        Class.forName("com.amazon.redshift.jdbc42.Driver");
        this.connection = DriverManager.getConnection(url, user, password);
    }

    public boolean checkTableExists(String tableName) {
        boolean flag = false;
        try {
            DatabaseMetaData meta = connection.getMetaData();
            String[] type = {"TABLE"};
            ResultSet rs = meta.getTables(null, null, tableName, type);
            flag = rs.next();
        } catch (SQLException e) {
            throw new S3RedshiftJdbcConnectorException(
                    CommonErrorCodeDeprecated.TABLE_SCHEMA_GET_FAILED,
                    String.format(
                            "Check table is or not existed failed, table name is %s ", tableName),
                    e);
        }
        return flag;
    }

    public boolean execute(String sql) throws Exception {
        try (Statement statement = connection.createStatement()) {
            return statement.execute(sql);
        }
    }

    public synchronized void close() throws SQLException {
        connection.close();
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Confirm the JDBC connection is alive (enable keepalive/timeout settings on the Redshift JDBC URL)
  2. Verify the table name matches exactly (Redshift stores lowercase identifiers; check quoting)
  3. Grant the user access to the schema/catalog so DatabaseMetaData.getTables can enumerate the table

Example fix

// before
jdbc_url = "jdbc:redshift://host:5439/dev"
// after (add keepalives/timeout)
jdbc_url = "jdbc:redshift://host:5439/dev?tcpKeepAlive=true&socketTimeout=300"
Defensive patterns

Strategy: retry

Validate before calling

// ensure connection is live before metadata call
if (connection.isClosed() || !connection.isValid(5)) connection = reopenConnection();

Try / catch

try {
    client.checkTableExists(tableName);
} catch (S3RedshiftJdbcConnectorException e) {
    // retry once with a fresh connection before failing the job
}

Prevention

When it happens

Trigger: Calling checkTableExists when the JDBC connection is stale/closed, the table name pattern causes a metadata query error, or the Redshift server drops the session mid-call.

Common situations: Long-running jobs whose idle connection was terminated by a firewall/load balancer, incorrect case-sensitive table names, or permission issues on the catalog metadata views.

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/c6f546761574fbc4. Report an issue: GitHub.