Reply
New Contributor
Posts: 1
Registered: ‎03-18-2019
Accepted Solution

CLoudera Envelope : sample config for json with avro schema

Could you please provide a sample config for specifying schema in avro format for reading json input file for Cloudera Envelope

Highlighted
Cloudera Employee
Posts: 50
Registered: ‎08-26-2015

Re: CLoudera Envelope : sample config for json with avro schema

Hi akumar,

 

This is a simple example:

 

steps {
  read_json {
    input {
      type = filesystem
      format = json
      avro-schema.literal = """
        {
          "type": "record",
          "name": "for_json",
          "fields" : [
            {"name": "field1", "type": "string"},
            {"name": "field2", "type": "int"}
          ]
        }"""
      path = test.json
    }
    print.data.enabled = true
  }
}

But this may not be necessary -- if you don't provide a schema the filesystem input will try to infer the schema from the JSON data you provide.

 

Jeremy