With the new direct PubSub to BigQuery announced July 2022, we can now create BigQuery subscriptions that get data pushed from PubSub directly.
When it comes to timestamp fields, how are they mapped to BigQuery? Things I tried:
Enable "use schema" in PubSub and create a BQ table with a
created_at: TIMESTAMPThe documentation doesn't seem to specify a timestamp mapping for Protobuf, so ignoring this.
When using Avro Logical fields, the error I'm getting when creating a subscription is like
Incompatible schema type for field created_at: expected INT64, got TIMESTAMP.
Example of PubSub topic schemas tried:
{
"type": "record",
"name": "Avro",
"fields": [
{
"name": "created_at",
"type": {
"type": "<long|int>",
"logicalType": "timestamp-<millis|micros>"
}
}
]
}
What's the correct way to create a PubSub schema for Timestamp fields?