When you connect to a DSE cluster with the DSE driver, additional information will be available in the metadata.


Metadata.getNodes() returns regular Node instances, but they hold additional key/value pairs in their getExtras() field. The keys are listed in DseNodeProperties; refer to the javadocs of that class for more details, in particular the runtime type of the values.

For example, here’s how to retrieve the DSE workloads of a node:

Node node = metadata.getNodes().values().iterator().next();
Set<String> workloads = (Set<String>) node.getExtras().get(DseNodeProperties.DSE_WORKLOADS);

Schema metadata

All schema metadata interfaces accessible through Metadata.getKeyspaces() have a DSE-specific subtype in the package com.datastax.dse.driver.api.core.metadata.schema. The objects returned by the DSE driver implement those types, so you can safely cast:

for (KeyspaceMetadata keyspace : session.getMetadata().getKeyspaces().values()) {
  DseKeyspaceMetadata dseKeyspace = (DseKeyspaceMetadata) keyspace;

If you’re calling a method that returns an optional and want to keep the result wrapped, use this pattern:

Optional<DseFunctionMetadata> f =
        .flatMap(ks -> ks.getFunction("f"))

For future extensibility, there is a DseXxxMetadata subtype for every OSS type. But currently (DSE 6.7), the only types that really add extra information are:

All other types (keyspaces, tables, etc.) are identical to their OSS counterparts.