View Source AvroUtils

Hex.pm

Utility library to convert term to BigQuery compatible json based on avro schema

avro-type-conversion

Avro Type Conversion

Primitive Types

AvroBigQuery
nullcould be used as part of union type
booleanBOOLEAN
intINTEGER
longINTEGER
floatFLOAT
doubleFLOAT
bytesBYTES
stringSTRING

Complex Types

AvroBigQuery
recordRECORD
enumSTRING
arrayREPEATED
mapREAPEATED RECORD with key and value
uniononly supports union with max 2 options and max 1 non nullable type.
fixedBYTES

Logical Types

AvroBigQuery
dateDATE
time-millisTIME
time-microsTIME
timestamp-millisTIMESTAMP
timestamp-microsTIMESTAMP

bq.transform

AvroBigQuery
{"name": "created_at", "type": { "type": "string", "bq.transform": "iso8601_to_timestamp" }}{ "mode": "REQUIRED", "name": "created_at", "type": "TIMESTAMP" }
{"name": "detail","type": { "type": "string", "bq.transform": "any_to_json" }}{ "mode": "REQUIRED", "name": "detail", "type": "STRING" }

bq.source_name

AvroBigQuery
{"name": "full_name","type": { "type": "string", "bq.source_name": "full-name" }}{ "mode": "REQUIRED", "name": "full_name", "type": "STRING" }