Hi,
I have some code using v2.1 of the Datastax driver that used CQL, getting info about columns in a table, the type of the column, and index (if any)
SELECT column_name, index_name, validator FROM system.schema_columns WHERE keyspace_name=? AND columnfamily_name=?
In v3 of the driver this CQL doesn't seem to be an option (some error message, can't remember off the top of my head), and I have seen through other posts that I could use
KeyspaceMetadata ks = session.getCluster().getMetadata().getKeyspace(schemaName);
TableMetadata table = ks.getTable(tableName);
List<ColumnMetadata> colmds = table.getColumns();
Collection<IndexMetadata> indexmds = table.getIndexes();
This works fine for columns, getting the name and "type", but I'm struggling to get info about how an index relates to a column or columns.
What am I missing to get the equivalent of the v2.1 CQL?
Second question would be, is using the XXXMetadata the most efficient, recommended way to get this info? (it's only used as a one-off up front checker of structure).
Thanks!