Getting Schema

Learn how to get schema without invoking any RDDs/DataFrames.

Get and Print Schema

Data Access API v1.0:

af_framework
  .dataAccess.dataset(
    new EntityDatasetBuilder()
      .ofType("configuration/entityTypes/ProfessionalAssociation")
      .activeOnly(true)
  ).schema().get(0).printTreeString()

Data Access API v2.0:

val entityType = "configuration/entityTypes/HCO"
val entData = af_framework.entitiesSchema(entityType, activeOnly=true).printTreeString()
Tip: To get schema without any RDDs/DataFrames invocation, you can call DataAccess.schema(). The method returns a list of StructType. You can also print the schema using this method of Spark API: printTreeString().