Skip to content

Decoders

These functions are used to decode common input data structures into BigQuery structured data columns.

Functions

decode_pubsub_scheduled_query_data

Attribute Value
Name decode_pubsub_scheduled_query_data
ID bqtools.[region].decode_pubsub_scheduled_query_data
Description Decodes the JSON data column from Scheduled Query notifications sent to BigQuery via a PubSub BigQuery subscription into a STRUCT.
Type FUNCTION
Arguments data JSON
Returns data STRUCT
Dependencies None

execution: decode_pubsub_scheduled_query_data

SELECT *
EXCEPT(data),
bqtools.eu.decode_pubsub_scheduled_query_data(data) AS data
FROM [project_id].BQMANAGER.SCHEDULED_QUERY_LOGS
SELECT *
EXCEPT(data),
bqtools.us.decode_pubsub_scheduled_query_data(data) AS data
FROM [project_id].BQMANAGER.SCHEDULED_QUERY_LOGS
response schema: decode_pubsub_scheduled_query_data
Column Path Mode Data Type
data.dataSourceId NULLABLE STRING
data.destinationDatasetId NULLABLE STRING
data.emailPreferences NULLABLE RECORD
data.emailPreferences.enableFailureEmail NULLABLE BOOLEAN
data.endTime NULLABLE TIMESTAMP
data.errorStatus NULLABLE RECORD
data.errorStatus.code NULLABLE INTEGER
data.errorStatus.message NULLABLE STRING
data.notificationPubsubTopic NULLABLE STRING
data.params NULLABLE RECORD
data.params.query NULLABLE STRING
data.runTime NULLABLE TIMESTAMP
data.scheduleTime NULLABLE TIMESTAMP
data.startTime NULLABLE TIMESTAMP
data.state NULLABLE STRING
data.updateTime NULLABLE TIMESTAMP
data.userId NULLABLE STRING

decode_pubsub_scheduled_query_attributes

Attribute Value
Name decode_pubsub_scheduled_query_attributes
ID bqtools.[region].decode_pubsub_scheduled_query_attributes
Description Decodes the JSON attributes column into a STRUCT from a Scheduled Query notification sent to BigQuery via a PubSub BigQuery subscription.
Type FUNCTION
Arguments attributes JSON
Returns attributes STRUCT
Dependencies None

execution: decode_pubsub_scheduled_query_attributes

SELECT *
EXCEPT(attributes),
bqtools.eu.decode_pubsub_scheduled_query_attributes(attributes) AS attributes
FROM [project_id].BQMANAGER.SCHEDULED_QUERY_LOGS
SELECT *
EXCEPT(attributes),
bqtools.us.decode_pubsub_scheduled_query_attributes(attributes) AS attributes
FROM [project_id].BQMANAGER.SCHEDULED_QUERY_LOGS
response schema: decode_pubsub_scheduled_query_attributes
Column Path Mode Data Type
attributes.eventType NULLABLE STRING
attributes.payloadFormat NULLABLE STRING