Table of ContentsAvro is used to define the data schema for a record's value. Thisschema describes the fields allowed in the value, along with theirdata types.You apply a schema to the value portion of an Oracle NoSQL Database record usingAvro bindings. These bindings are used to serialize valuesbefore writing them, and to deserialize values after readingthem.
Avro Keyboard was born in the 26th March, 2003 (The Independence Day of Bangladesh), bringing a new era in Bangla computing. It's flexible, gorgeous, feature rich, totally customizable, user friendly and already has a lot of typing automation tools that you have never imagined! Identifies the JSON field type. For Avro schemas, this must always be record when it is specified at the schema's top level. The type record means that there will be multiple fields defined. This identifies the namespace in which the object lives.
The usage of these bindings requires your applications to usethe Avro data format, which means that each stored value isassociated with a schema.The use of Avro schemas allows serialized values to bestored in a very space-efficient binary format. Each value isstored without any metadata other than a small internal schemaidentifier, between 1 and 4 bytes in size.
One such reference isstored per key-value pair. In this way, the serialized Avro dataformat is always associated with the schema used to serialize it,with minimal overhead. This association is made transparently tothe application, and the internal schema identifier is managed bythe bindings supplied by the AvroCatalog class.
The applicationnever sees or uses the internal identifier directly.The Avro API is the result of an open source project provided by theApache Software Foundation. It is formally described here.In addition, Avro makes use of the Jackson APIs for parsing JSON.This is likely to be of interest to you if you are integratingOracle NoSQL Database with a JSON-based system. Jackson is formally describedhere:.typeIdentifies the JSON field type. For Avro schemas, thismust always be record when it isspecified at the schema's top level.
The typerecord means that there will bemultiple fields defined.namespaceThis identifies the namespace in which the objectlives. Essentially, this is meant to be a URI that hasmeaning to you and your organization. It is used todifferentiate one schema type from another should theyshare the same name.nameThis is the schema name which, when combined with thenamespace, uniquely identifies the schema within thestore. In the above example, the fully qualified namefor the schema is com.example.FullName.fieldsThis is the actual schema definition. It defines whatfields are contained in the value, and the data typefor each field. A field can be a simple data type, suchas an integer or a string, or it can be complex data.We describe this in more detail, below.Note that schema field names must begin with A-Za-z, andsubsequently contain only A-Za-z0-9.To use the schema, you must define it in a flat text file, andthen add the schema to your store using the appropriate commandline call.
You must also somehow provide it to your code. Theschema that your code is using must correspond to the schema thathas been added to your store.The remainder of this chapter describes schemas and how to addthem to your store. For a description of how to use schemas inyour code, see.nameThis is the record's name, and it is required.It is meant to identify the thing that therecord describes. For example:PersonInformation orAutomobiles orHats orBankDeposit.Note that record names must begin with A-Za-z, andsubsequently contain only A-Za-z0-9.namespaceA namespace is an optional attribute that uniquelyidentifies the record. It is optional, but itshould be used when there is a chance that therecord's name will collide with anotherrecord's name. For example, suppose you have arecord that describes an employee. However, youmight have several different types ofemployees: full-time, part time, andcontractors.
So you might then create all threetypes of records with the nameEmployeeInfo, but then withnamespaces such as FullTime,PartTime andContractor. The fullyqualified name for the records used to describefull time employees would then beFullTime.EmployeeInfo.Alternatively, if your store containsinformation for many different organizations,you might want to use a namespace thatidentifies the organization used by the recordso as to avoid collisions in the record names.In this case, you could end up with fullyqualified records with names such asMy.Company.Manufacturing.EmployeeInfoand My.Company.Sales.EmployeeInfo.docThis optional attribute simply provides documentation aboutthe record. It is parsed and stored with theschema, and is available from the Schema objectusing the Avro API, but it is not used duringserialization.aliasesThis optional attribute provides a JSON array of strings thatare alternative names for the record. Note thatthere is no such thing as a rename operationfor JSON schema. So if you want to refer to aschema by a name other than what you initiallydefined in the nameattribute, use an alias.typeA required attribute that is either the keywordrecord, or an embedded JSONschema definition.
If this attribute is for thetop-level schema definition,record must be used.fieldsA required attribute that provides a JSON array which listsall of the fields in the schema. Each fieldmust provide a name and a type attribute. Each field mayprovide doc, order, aliases and defaultattributes.The name, type, doc and aliases attributes areused in the exact same way as described earlierin this section.As is the case with record names, fieldnames must begin with A-Za-z, andsubsequently contain only A-Za-z0-9.The order attribute is optional, and itis ignored by Oracle NoSQL Database. For applications(other than Oracle NoSQL Database) that honor it, thisattribute describes how this fieldimpacts sort ordering of this record.Valid values areascending,descending, orignore. For moreinformation on how this works, see.The default attribute is optional,but highly recommended in order to supportschema evolution. It provides a default valuefor the field that is used only for thepurposes of schema evolution.
Use of the defaultattribute does not mean that you can fail toinitialize the field when creating a new valueobject; all fields must be initializedregardless of whether the default attribute ispresent.Schema evolution is described in.Permitted values for the default attributedepend on the field's type. Default values forunions depend on the first field in the union.Default values for bytes and fixed fields areJSON strings.