From ffdec938d1834eb0529028f7a47cf81722e35c51 Mon Sep 17 00:00:00 2001 From: femi3211 Date: Wed, 4 Feb 2026 14:40:30 +0100 Subject: [PATCH] fix: Catch SQLException in attachTableType, log a warning, and continue extract so shard_kind/persistence are skipped when not supported. --- .../table/KineticaTablesExtractor.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/table/KineticaTablesExtractor.java b/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/table/KineticaTablesExtractor.java index 6e055b98..a6bdf145 100644 --- a/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/table/KineticaTablesExtractor.java +++ b/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/table/KineticaTablesExtractor.java @@ -32,21 +32,22 @@ public Collection extract(Connection target, java.sql.Connection connecti return tables; } - private void attachTableType(Collection
tables, java.sql.Connection connection) throws SQLException { - ResultSet resultSet = connection.createStatement().executeQuery("SELECT object_name, schema_name, shard_kind, persistence FROM ki_catalog.ki_objects;"); - - while (resultSet.next()) { - String object_schema = resultSet.getString("schema_name"); - String object_name = resultSet.getString("object_name"); - Optional
found_table = tables.stream().filter(table -> table.getSchema().equals(object_schema) && table.getName().equals(object_name)).findFirst(); - if (found_table.isPresent()) { - found_table.get().addProperty("shard_kind", resultSet.getString("shard_kind")); - found_table.get().addProperty("persistence", resultSet.getString("persistence")); + private void attachTableType(Collection
tables, java.sql.Connection connection) { + try (Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery("SELECT object_name, schema_name, shard_kind, persistence FROM ki_catalog.ki_objects;")) { + + while (resultSet.next()) { + String object_schema = resultSet.getString("schema_name"); + String object_name = resultSet.getString("object_name"); + Optional
found_table = tables.stream().filter(table -> table.getSchema().equals(object_schema) && table.getName().equals(object_name)).findFirst(); + if (found_table.isPresent()) { + found_table.get().addProperty("shard_kind", resultSet.getString("shard_kind")); + found_table.get().addProperty("persistence", resultSet.getString("persistence")); + } } - } - - if (!resultSet.isClosed()) { - resultSet.close(); + } catch (SQLException e) { + log.warn("Could not attach table type (shard_kind, persistence) from ki_catalog.ki_objects. " + + "Extraction will continue without these properties."); } }