1 Answer
- Newest
- Most votes
- Most comments
1
SiteWise exports the Avro Schema into the header of the exported .avro file, so no need to load a separate Avro schema when reading the file. Here a sample python script to read a SiteWise avro export and dumps the schema:
>>> from avro.io import DatumReader
>>> from avro.datafile import DataFileReader
>>> avro_reader = DataFileReader(open("/tmp/raw_a50553ae-184e-4cea-ba5a-847e6d76e4ac_c82738f4-d145-4b12-8b6a-
>>> avro_reader.meta
{'avro.schema': b'{"type":"record","name":"RawDatum","namespace":"amazon.aws.iot.sitewise.raw","fields":[{"name":"seriesId","type":"string"},{"name":"timeInSeconds","type":"long"},{"name":"offsetInNanos","type":"long"},{"name":"quality","type":"string"},{"name":"doubleValue","type":["null","double"],"default":null},{"name":"stringValue","type":["null","string"],"default":null},{"name":"integerValue","type":["null","int"],"default":null},{"name":"booleanValue","type":["null","boolean"],"default":null},{"name":"jsonValue","type":["null","string"],"default":null},{"name":"recordVersion","type":["null","long"],"default":null}]}', 'avro.codec': b'snappy'}
Relevant content
- asked 3 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago