-1

[Question posted by a user on YugabyteDB Community Slack]

How can I get metadata info about indexes from the driver? https://github.com/yugabyte/cassandra-java-driver/blob/3.10.0-yb-x/driver-core/src/main/java/com/datastax/driver/core/IndexMetadata.java I use this one but I do not see any info about unique status or about where conditions.

dh YB
  • 965
  • 3
  • 10

1 Answers1

0

You can query the system_schema.indexes table:

ycqlsh:ybdemo> select * from system_schema.indexes;

 keyspace_name | table_name | index_name         | kind       | options                                                                  | table_id                             | index_id                             | transactions        | is_unique | tablets
---------------+------------+--------------------+------------+--------------------------------------------------------------------------+--------------------------------------+--------------------------------------+---------------------+-----------+---------
        ybdemo |        emp |      emp_by_userid | COMPOSITES |                                  {'include': 'enum', 'target': 'userid'} | 13563f8c-997e-a298-de46-0c05025e00a7 | 57b96b7f-6be9-55b8-4145-c30739b6d467 | {'enabled': 'true'} |      True |    null
        ybdemo |        emp | emp_by_userid_bbbb | COMPOSITES | {'include': 'enum', 'predicate': 'lastname = ''x''', 'target': 'userid'} | 13563f8c-997e-a298-de46-0c05025e00a7 | f44cc10d-5251-6189-8040-6d73857f09dc | {'enabled': 'true'} |      True |    null

You can see both is_unique and predicate that is used on the partial index. This was done on 2.15.0.0.

dh YB
  • 965
  • 3
  • 10