Data formats

CSV Format

To declare that a type should be read/written as Csv, add the com.orbitalhq.formats.Csv annotation to a model:

import com.orbitalhq.formats.Csv

@Csv
model Person {
  firstName : FirstName inherits String
}

Csv options

The following options are available:

Parameter nameDescriptionDefault value
delimiterThe delimiter between records,
firstRecordAsHeaderIndicates if the first record should be read as a headertrue
nullValueSpecify a custom string to be read as null
containsTrailingDelimitersIndicates if each row contains a delimiter which should be ignoredfalse
quoteCharSpecifies which character should be read as a quoting character"

For example:

import com.orbitalhq.formats.Csv

@Csv(
  delimiter = "|",
  nullValue = "NULL"
)
model Person {
  firstName : String
  lastName : String
  age : Int
}

Using column() references

Deprecated

Using the by column tag is deprecated. Field names in the model are now used to match columns

It’s possible (but discouraged) to use by column("") references to declare a column:

model Person {
  firstName : FirstName by column("fName")
}
Previous
Avro
Next
Json