diff --git a/v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/dbutils/dao/source/CassandraDao.java b/v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/dbutils/dao/source/CassandraDao.java index c73be6f50..24f5e5b87 100644 --- a/v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/dbutils/dao/source/CassandraDao.java +++ b/v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/dbutils/dao/source/CassandraDao.java @@ -57,44 +57,4 @@ public void write(DMLGeneratorResponse dmlGeneratorResponse) throws Exception { session.execute(boundStatement); } } - - /** - * Reads metadata for the specified Cassandra keyspace. - * - *

This method retrieves metadata from the Cassandra system schema, including table names, - * column names, column types, and kinds, for the given keyspace. It uses a prepared statement for - * safe and efficient execution. - * - * @param keyspace The name of the Cassandra keyspace for which metadata is to be retrieved. Must - * not be {@code null} or empty. - * @return A {@link ResultSet} containing the metadata rows with columns: - *

- * - * @throws IllegalArgumentException If the provided keyspace name is {@code null} or empty. - * @throws ConnectionException If a connection to the Cassandra database could not be established. - * @throws Exception If any other unexpected error occurs during the operation. - */ - public ResultSet readMetadata(String keyspace) throws Exception { - if (keyspace == null || keyspace.isEmpty()) { - throw new IllegalArgumentException("Keyspace name cannot be null or empty."); - } - - String query = - "SELECT table_name, column_name, type, kind FROM system_schema.columns WHERE keyspace_name = ?"; - - try (CqlSession session = (CqlSession) connectionHelper.getConnection(this.cassandraUrl)) { - if (session == null) { - throw new ConnectionException("Failed to establish a connection."); - } - - PreparedStatement preparedStatement = session.prepare(query); - BoundStatement boundStatement = preparedStatement.bind(keyspace); - return session.execute(boundStatement); - } - } }