BigQuery standard SQL supports query jobs where the query text is a
script. A script can include one or more SQL statements and additional
logic. This is documented at https://cloud.google.com/bigquery/docs/reference/standard-sql/scripting.
In terms of metadata, BigQuery represents a query job with scripting as
one parent job and a child job for each of the SQL statements in the
script. Because both a parent job and child jobs can appear in
metadata, care should be taken to avoid double counting metrics when
aggregating.
Fields to expect in the metadata for a scripting parent job are listed below.
- configuration: typical
configuration subfields
- configuration.jobType:
"QUERY"
- configuration.query.query:
complete script
- etag: hash of this resource
- id:
"projectId
:location
.jobId
"
- jobReference.jobId: job
identifier
- jobReference.location:
location
- jobReference.projectId:
project identifier
- kind:
"bigquery#job"
- selfLink:
HTTP link
- statistics: only subfields
listed below
- statistics.creationTime: job
creation time
- statistics.endTime: job end
time
- statistics.numChildJobs:
number of child jobs
- statistics.query.statementType:
"SCRIPT"
- statistics.query.totalBytesBilled:
total bytes billed
- statistics.query.totalBytesProcessed:
total bytes processed
- statistics.query.totalSlotMs: total
slot milliseconds
- statistics.startTime: start
time
- statistics.totalBytesProcessed: total
bytes processed
- statistics.totalSlotMs:
total slot milliseconds
- status.state: state
- user_email: user email
Each scripting child job will contain the set of fields it would
contain if it were not part of a script. Fields to expect in the
metadata for a scripting child job are listed below.
- configuration: typical
configuration fields are inherited from the scripting parent
job
- configuration.jobType:
"QUERY"
- configuration.query.query: a
single SQL statement
- configuration.query.queryParameters:
- error.formatted_stack_trace
- error.message
- error.stack_trace.line
- error.stack_trace.column
- error.stack_trace.filename
- error.stack_trace.location
- error.statement_text
- error.row_count
- etag: hash of this resource
- id:
"projectId
:location
.jobId
"
- jobReference.jobId: job
identifier
- jobReference.location:
location
- jobReference.projectId:
project identifier
- kind:
"bigquery#job"
- selfLink:
HTTP link
- statistics: typical
statistics subfields
- statistics.parentJobId:
parent job identifier
- statistics.scriptStatistics.evaluationKind:
one of:
"STATEMENT"
"EXPRESSION"
"EVALUATION_KIND_UNSPECIFIED"
- statistics.scriptStatistics.stackFrames.endColumn:
child job statement end column position within script text
- statistics.scriptStatistics.stackFrames.endLine:
child job statement end line position within script text
- statistics.scriptStatistics.stackFrames.startColumn:
child job statement start column position within script text
- statistics.scriptStatistics.stackFrames.startLine:
child job statement start line position within script text
- statistics.scriptStatistics.stackFrames.text:
child job statement
- status.state: state
- user_email: user email
See links below for references.