Skip to main content

jobs

Creates, updates, deletes, gets or lists a jobs resource.

Overview

Namejobs
TypeResource
Idgoogle.bigquery.jobs

Fields

NameDatatypeDescription
idstringOutput only. Opaque ID field of the job.
configurationobject
etagstringOutput only. A hash of this resource.
jobCreationReasonobjectReason about why a Job was created from a jobs.query method when used with JOB_CREATION_OPTIONAL Job creation mode. For jobs.insert method calls it will always be REQUESTED. Preview
jobReferenceobjectA job reference is a fully qualified identifier for referring to a job.
kindstringOutput only. The type of the resource.
principal_subjectstringOutput only. [Full-projection-only] String representation of identity of requesting party. Populated for both first- and third-party identities. Only present for APIs that support third-party identities.
selfLinkstringOutput only. A URL that can be used to access the resource again.
statisticsobjectStatistics for a single job execution.
statusobject
user_emailstringOutput only. Email address of the user who ran the job.

Methods

NameAccessible byRequired ParamsDescription
getSELECT+jobId, projectIdReturns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.
listSELECTprojectIdLists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.
insertINSERTprojectIdStarts a new asynchronous job. This API has two different kinds of endpoint URIs, as this method supports a variety of use cases. The Metadata URI is used for most interactions, as it accepts the job configuration directly. The Upload URI is ONLY for the case when you're sending both a load job configuration and a data stream together. In this case, the Upload URI accepts the job configuration and the data as two distinct multipart MIME parts.
deleteDELETE+jobId, projectIdRequests the deletion of the metadata of a job. This call returns when the job's metadata is deleted.
cancelEXEC+jobId, projectIdRequests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.
queryEXECprojectIdRuns a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.

SELECT examples

Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.

SELECT
id,
configuration,
etag,
jobCreationReason,
jobReference,
kind,
principal_subject,
selfLink,
statistics,
status,
user_email
FROM google.bigquery.jobs
WHERE projectId = '{{ projectId }}';

INSERT example

Use the following StackQL query and manifest file to create a new jobs resource.

/*+ create */
INSERT INTO google.bigquery.jobs (
projectId,
configuration,
jobReference
)
SELECT
'{{ projectId }}',
'{{ configuration }}',
'{{ jobReference }}'
;

DELETE example

Deletes the specified jobs resource.

/*+ delete */
DELETE FROM google.bigquery.jobs
WHERE +jobId = '{{ +jobId }}'
AND projectId = '{{ projectId }}';