How to know the c3Type associated to a given cassandra schema?

#1

By given Cassandra schema name, “structure_Measurement”, how may I find the c3 Type on top of that table?

0 Likes

#2

The schema name itself is module_Type . So it’s Measurement

1 Like

#3

A programmatic approach is to query the TagMetadataStore and look at the schema name for each type. More efficient options may exist, but I do not believe the TagMetadataStore or MetadataGraph support searching by schema name.

Here is an example:

var schemaName = "BackBlazeMeasurement";
var tms = TagMetadataStore.tag();


// Retrieve types of interest.  Tailor this to meet your requirements
var types = tms.typesThatMixin("Persistable");

types.forEach(function (t) {
  var typ = tms.readType(t.typeName);

  if (typ.declaredAnnotations.schema != undefined) {
        if (typ.declaredAnnotations.schema.name == schemaName) {
          console.log(schemaName + " found in Type " + t.typeName);
    } 
  }
})

Alternatively, you could search your GitRepository to find all references to the schema name specified.

1 Like