Jobs

Jobs are objects that manage asynchronous tasks such as running queries, loading data, and exporting data. You can run multiple jobs concurrently in BigQuery, and completed jobs will be listed in the Jobs collection.

The Jobs collection stores your project's complete job history, but availability is only guaranteed for jobs created in the past six months. To request automatic deletion of jobs that are more than 50 days old, contact support.

Each job resource includes one of the following child properties, which defines the job type.

Child PropertyDescription
loadLoad data from one of several formats into a table. Specify the file location by URI. For load job configuration options, see configuration.load.
queryRun a query against BigQuery data. For query job configuration options, see configuration.query.
extractExport a BigQuery table to Google Cloud Storage. For extract job configuration options, see configuration.extract.
copyCopy an existing table to another new or existing table. For copy job configuration options, see configuration.copy.

For a list of methods for this resource, see the end of this page.

Resource representations

{
  "kind": "bigquery#job",
  "etag": etag,
  "id": string,
  "selfLink": string,
  "jobReference": {
    "projectId": string,
    "jobId": string
  },
  "configuration": {
    "query": {
      "query": string,
      "destinationTable": {
        "projectId": string,
        "datasetId": string,
        "tableId": string
      },
      "tableDefinitions": {
        (key): {
          "sourceUris": [
            string
          ],
          "schema": {
            "fields": [
              {
                "name": string,
                "type": string,
                "mode": string,
                "fields": [
                  (TableFieldSchema)
                ],
                "description": string
              }
            ]
          },
          "sourceFormat": string,
          "maxBadRecords": integer,
          "autodetect": boolean,
          "ignoreUnknownValues": boolean,
          "compression": string,
          "csvOptions": {
            "fieldDelimiter": string,
            "skipLeadingRows": long,
            "quote": string,
            "allowQuotedNewlines": boolean,
            "allowJaggedRows": boolean,
            "encoding": string
          },
          "bigtableOptions": {
            "columnFamilies": [
              {
                "familyId": string,
                "type": string,
                "encoding": string,
                "columns": [
                  {
                    "qualifierEncoded": bytes,
                    "qualifierString": string,
                    "fieldName": string,
                    "type": string,
                    "encoding": string,
                    "onlyReadLatest": boolean
                  }
                ],
                "onlyReadLatest": boolean
              }
            ],
            "ignoreUnspecifiedColumnFamilies": boolean
          },
          "googleSheetsOptions": {
            "skipLeadingRows": long
          }
        }
      },
      "userDefinedFunctionResources": [
        {
          "resourceUri": string,
          "inlineCode": string
        }
      ],
      "createDisposition": string,
      "writeDisposition": string,
      "defaultDataset": {
        "datasetId": string,
        "projectId": string
      },
      "priority": string,
      "preserveNulls": boolean,
      "allowLargeResults": boolean,
      "useQueryCache": boolean,
      "flattenResults": boolean,
      "maximumBillingTier": integer,
      "useLegacySql": boolean
    },
    "load": {
      "sourceUris": [
        string
      ],
      "schema": {
        "fields": [
          {
            "name": string,
            "type": string,
            "mode": string,
            "fields": [
              (TableFieldSchema)
            ],
            "description": string
          }
        ]
      },
      "destinationTable": {
        "projectId": string,
        "datasetId": string,
        "tableId": string
      },
      "createDisposition": string,
      "writeDisposition": string,
      "fieldDelimiter": string,
      "skipLeadingRows": integer,
      "encoding": string,
      "quote": string,
      "maxBadRecords": integer,
      "schemaInlineFormat": string,
      "schemaInline": string,
      "allowQuotedNewlines": boolean,
      "sourceFormat": string,
      "allowJaggedRows": boolean,
      "ignoreUnknownValues": boolean,
      "projectionFields": [
        string
      ],
      "autodetect": boolean
    },
    "copy": {
      "sourceTable": {
        "projectId": string,
        "datasetId": string,
        "tableId": string
      },
      "sourceTables": [
        {
          "projectId": string,
          "datasetId": string,
          "tableId": string
        }
      ],
      "destinationTable": {
        "projectId": string,
        "datasetId": string,
        "tableId": string
      },
      "createDisposition": string,
      "writeDisposition": string
    },
    "extract": {
      "sourceTable": {
        "projectId": string,
        "datasetId": string,
        "tableId": string
      },
      "destinationUri": string,
      "destinationUris": [
        string
      ],
      "printHeader": boolean,
      "fieldDelimiter": string,
      "destinationFormat": string,
      "compression": string
    },
    "dryRun": boolean
  },
  "status": {
    "state": string,
    "errorResult": {
      "reason": string,
      "location": string,
      "debugInfo": string,
      "message": string
    },
    "errors": [
      {
        "reason": string,
        "location": string,
        "debugInfo": string,
        "message": string
      }
    ]
  },
  "statistics": {
    "creationTime": long,
    "startTime": long,
    "endTime": long,
    "totalBytesProcessed": long,
    "query": {
      "queryPlan": [
        {
          "name": string,
          "id": long,
          "waitRatioAvg": double,
          "waitRatioMax": double,
          "readRatioAvg": double,
          "readRatioMax": double,
          "computeRatioAvg": double,
          "computeRatioMax": double,
          "writeRatioAvg": double,
          "writeRatioMax": double,
          "recordsRead": long,
          "recordsWritten": long,
          "steps": [
            {
              "kind": string,
              "substeps": [
                string
              ]
            }
          ]
        }
      ],
      "totalBytesProcessed": long,
      "totalBytesBilled": long,
      "billingTier": integer,
      "cacheHit": boolean,
      "referencedTables": [
        {
          "projectId": string,
          "datasetId": string,
          "tableId": string
        }
      ],
      "schema": {
        "fields": [
          {
            "name": string,
            "type": string,
            "mode": string,
            "fields": [
              (TableFieldSchema)
            ],
            "description": string
          }
        ]
      }
    },
    "load": {
      "inputFiles": long,
      "inputFileBytes": long,
      "outputRows": long,
      "outputBytes": long
    },
    "extract": {
      "destinationUriFileCounts": [
        long
      ]
    }
  },
  "user_email": string
}
Property name Value Description Notes
configuration nested object [Required] Describes the job configuration.
configuration.copy nested object [Pick one] Copies a table.
configuration.copy.createDisposition string [Optional] Specifies whether the job is allowed to create new tables.

The following values are supported:
  • CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table.
  • CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result.
The default value is CREATE_IF_NEEDED.

Creation, truncation and append actions occur as one atomic update upon job completion.
configuration.copy.destinationTable nested object [Required] The destination table
configuration.copy.destinationTable.datasetId string [Required] The ID of the dataset containing this table.
configuration.copy.destinationTable.projectId string [Required] The ID of the project containing this table.
configuration.copy.destinationTable.tableId string [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
configuration.copy.sourceTable nested object [Pick one] Source table to copy.
configuration.copy.sourceTable.datasetId string [Required] The ID of the dataset containing this table.
configuration.copy.sourceTable.projectId string [Required] The ID of the project containing this table.
configuration.copy.sourceTable.tableId string [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
configuration.copy.sourceTables[] list [Pick one] Source tables to copy.
configuration.copy.sourceTables[].datasetId string [Required] The ID of the dataset containing this table.
configuration.copy.sourceTables[].projectId string [Required] The ID of the project containing this table.
configuration.copy.sourceTables[].tableId string [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
configuration.copy.writeDisposition string [Optional] Specifies the action that occurs if the destination table already exists.

The following values are supported: 
  • WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. 
  • WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. 
  • WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. 
The default value is WRITE_EMPTY

Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
configuration.dryRun boolean [Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined.
configuration.extract nested object [Pick one] Configures an extract job. For more information, see exporting data from BigQuery.
configuration.extract.compression string [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
configuration.extract.destinationFormat string [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
configuration.extract.destinationUri string [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
configuration.extract.destinationUris[] list [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
configuration.extract.fieldDelimiter string [Optional] Delimiter to use between fields in the exported data. Default is ','
configuration.extract.printHeader boolean [Optional] Whether to print out a header row in the results. Default is true.
configuration.extract.sourceTable nested object [Required] A reference to the table being exported.
configuration.extract.sourceTable.datasetId string [Required] The ID of the dataset containing this table.
configuration.extract.sourceTable.projectId string [Required] The ID of the project containing this table.
configuration.extract.sourceTable.tableId string [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
configuration.load nested object [Pick one] Configures a load job.
configuration.load.allowJaggedRows boolean [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
configuration.load.allowQuotedNewlines boolean Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
configuration.load.autodetect boolean [Experimental] Indicates if we should automatically infer the options and schema for CSV and JSON sources.
configuration.load.createDisposition string [Optional] Specifies whether the job is allowed to create new tables. 

The following values are supported: 
  • CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. 
  • CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. 
The default value is CREATE_IF_NEEDED

Creation, truncation and append actions occur as one atomic update upon job completion.
configuration.load.destinationTable nested object [Required] The destination table to load the data into.
configuration.load.destinationTable.datasetId string [Required] The ID of the dataset containing this table.
configuration.load.destinationTable.projectId string [Required] The ID of the project containing this table.
configuration.load.destinationTable.tableId string [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
configuration.load.encoding string [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8.

BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties.
configuration.load.fieldDelimiter string [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (',').
configuration.load.ignoreUnknownValues boolean [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
configuration.load.maxBadRecords integer [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
configuration.load.projectionFields[] list [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
configuration.load.quote string [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.
configuration.load.schema nested object [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore.
configuration.load.schema.fields[] list Describes the fields in a table.
configuration.load.schema.fields[].description string [Optional] The field description. The maximum length is 16K characters.
configuration.load.schema.fields[].fields[] list [Optional] Describes the nested schema fields if the type property is set to RECORD.
configuration.load.schema.fields[].mode string [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
configuration.load.schema.fields[].name string [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
configuration.load.schema.fields[].type string [Required] The field data type. Possible values include STRING, BYTES, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
configuration.load.schemaInline string [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
configuration.load.schemaInlineFormat string [Deprecated] The format of the schemaInline property.
configuration.load.skipLeadingRows integer [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
configuration.load.sourceFormat string [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO". The default value is CSV.
configuration.load.sourceUris[] list [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
configuration.load.writeDisposition string [Optional] Specifies the action that occurs if the destination table already exists.

The following values are supported: 
  • WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. 
  • WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. 
  • WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. 
The default value is WRITE_APPEND

Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
configuration.query nested object [Pick one] Configures a query job.
configuration.query.allowLargeResults boolean If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. For more information, see returning large query results.
configuration.query.createDisposition string [Optional] Specifies whether the job is allowed to create new tables. 

The following values are supported: 
  • CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. 
  • CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. 
The default value is CREATE_IF_NEEDED

Creation, truncation and append actions occur as one atomic update upon job completion.
configuration.query.defaultDataset nested object [Optional] Specifies the default dataset to use for unqualified table names in the query.
configuration.query.defaultDataset.datasetId string [Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
configuration.query.defaultDataset.projectId string [Optional] The ID of the project containing this dataset.
configuration.query.destinationTable nested object Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
configuration.query.destinationTable.datasetId string [Required] The ID of the dataset containing this table.
configuration.query.destinationTable.projectId string [Required] The ID of the project containing this table.
configuration.query.destinationTable.tableId string [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
configuration.query.flattenResults boolean [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
configuration.query.maximumBillingTier integer [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default. For more information, see High-Compute queries.
configuration.query.preserveNulls boolean [Deprecated] This property is deprecated.
configuration.query.priority string [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
configuration.query.query string [Required] BigQuery SQL query to execute.
configuration.query.tableDefinitions object [Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
configuration.query.tableDefinitions.(key) nested object
configuration.query.tableDefinitions.(key).autodetect boolean [Experimental] Try to detect schema and format options automatically. Any option specified explicitly will be honored.
configuration.query.tableDefinitions.(key).bigtableOptions nested object [Optional] Additional options if sourceFormat is set to BIGTABLE.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[] list [Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].columns[] list [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].columns[].encoding string [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].columns[].fieldName string [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].columns[].onlyReadLatest boolean [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].columns[].qualifierEncoded bytes [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].columns[].qualifierString string
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].columns[].type string [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].encoding string [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].familyId string Identifier of the column family.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].onlyReadLatest boolean [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column.
configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies[].type string [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it.
configuration.query.tableDefinitions.(key).bigtableOptions.ignoreUnspecifiedColumnFamilies boolean [Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false.
configuration.query.tableDefinitions.(key).compression string [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
configuration.query.tableDefinitions.(key).csvOptions nested object Additional properties to set if sourceFormat is set to CSV.
configuration.query.tableDefinitions.(key).csvOptions.allowJaggedRows boolean [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false.
configuration.query.tableDefinitions.(key).csvOptions.allowQuotedNewlines boolean [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
configuration.query.tableDefinitions.(key).csvOptions.encoding string [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties.
configuration.query.tableDefinitions.(key).csvOptions.fieldDelimiter string [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (',').
configuration.query.tableDefinitions.(key).csvOptions.quote string [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.
configuration.query.tableDefinitions.(key).csvOptions.skipLeadingRows long [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
configuration.query.tableDefinitions.(key).googleSheetsOptions nested object [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS.
configuration.query.tableDefinitions.(key).googleSheetsOptions.skipLeadingRows long [Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
configuration.query.tableDefinitions.(key).ignoreUnknownValues boolean [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored.
configuration.query.tableDefinitions.(key).maxBadRecords integer [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
configuration.query.tableDefinitions.(key).schema nested object [Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats.
configuration.query.tableDefinitions.(key).schema.fields[] list Describes the fields in a table.
configuration.query.tableDefinitions.(key).schema.fields[].description string [Optional] The field description. The maximum length is 16K characters.
configuration.query.tableDefinitions.(key).schema.fields[].fields[] list [Optional] Describes the nested schema fields if the type property is set to RECORD.
configuration.query.tableDefinitions.(key).schema.fields[].mode string [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
configuration.query.tableDefinitions.(key).schema.fields[].name string [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
configuration.query.tableDefinitions.(key).schema.fields[].type string [Required] The field data type. Possible values include STRING, BYTES, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
configuration.query.tableDefinitions.(key).sourceFormat string [Required] The data format. For CSV files, specify "CSV". For Google sheets, specify "GOOGLE_SHEETS". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro files, specify "AVRO". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". [Experimental] For Google Cloud Bigtable, specify "BIGTABLE". Please note that reading from Google Cloud Bigtable is experimental and has to be enabled for your project. Please contact Google Cloud Support to enable this for your project.
configuration.query.tableDefinitions.(key).sourceUris[] list [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified, and it must end with '.backup_info'. Also, the '*' wildcard character is not allowed.
configuration.query.useLegacySql boolean [Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/. When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false.
configuration.query.useQueryCache boolean [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. For more information, see query caching.
configuration.query.userDefinedFunctionResources[] list [Experimental] Describes user-defined function resources used in the query.
configuration.query.userDefinedFunctionResources[].inlineCode string [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code.
configuration.query.userDefinedFunctionResources[].resourceUri string [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
configuration.query.writeDisposition string [Optional] Specifies the action that occurs if the destination table already exists.

The following values are supported: 
  • WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. 
  • WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. 
  • WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. 
The default value is WRITE_EMPTY

Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
etag etag [Output-only] A hash of this resource.
id string [Output-only] Opaque ID field of the job
jobReference nested object [Optional] An object that contains structured parts of the job ID. Reference describing the unique-per-user name of the job.
jobReference.jobId string [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
jobReference.projectId string [Required] The ID of the project containing this job.
kind bigquery#jobs [Output-only] The resource type. This property always returns the value bigquery#job.
statistics nested object [Output-only] Information about the job, including starting time and ending time of the job.
statistics.creationTime long [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
statistics.endTime long [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.
statistics.extract nested object [Output-only] Statistics for an extract job.
statistics.extract.destinationUriFileCounts[] list [Output-only] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field.
statistics.load nested object [Output-only] Statistics for a load job.
statistics.load.inputFileBytes long [Output-only] Number of bytes of source data in a load job.
statistics.load.inputFiles long [Output-only] Number of source files in a load job.
statistics.load.outputBytes long [Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.
statistics.load.outputRows long [Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.
statistics.query nested object [Output-only] Statistics for a query job.
statistics.query.billingTier integer [Output-only] Billing tier for the job.
statistics.query.cacheHit boolean [Output-only] Whether the query result was fetched from the query cache. For more information, see query caching.
statistics.query.queryPlan[] list [Output-only, Experimental] Describes execution plan for the query as a list of stages.
statistics.query.queryPlan[].computeRatioAvg double Relative amount of time the average shard spent on CPU-bound tasks.
statistics.query.queryPlan[].computeRatioMax double Relative amount of time the slowest shard spent on CPU-bound tasks.
statistics.query.queryPlan[].id long Unique ID for stage within plan.
statistics.query.queryPlan[].name string Human-readable name for stage.
statistics.query.queryPlan[].readRatioAvg double Relative amount of time the average shard spent reading input.
statistics.query.queryPlan[].readRatioMax double Relative amount of time the slowest shard spent reading input.
statistics.query.queryPlan[].recordsRead long Number of records read into the stage.
statistics.query.queryPlan[].recordsWritten long Number of records written by the stage.
statistics.query.queryPlan[].steps[] list List of operations within the stage in dependency order (approximately chronological).
statistics.query.queryPlan[].steps[].kind string Machine-readable operation type. For a full list of operation types, see Steps metadata.
statistics.query.queryPlan[].steps[].substeps[] list Human-readable stage descriptions.
statistics.query.queryPlan[].waitRatioAvg double Relative amount of time the average shard spent waiting to be scheduled.
statistics.query.queryPlan[].waitRatioMax double Relative amount of time the slowest shard spent waiting to be scheduled.
statistics.query.queryPlan[].writeRatioAvg double Relative amount of time the average shard spent on writing output.
statistics.query.queryPlan[].writeRatioMax double Relative amount of time the slowest shard spent on writing output.
statistics.query.referencedTables[] list [Output-only, Experimental] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list.
statistics.query.referencedTables[].datasetId string [Required] The ID of the dataset containing this table.
statistics.query.referencedTables[].projectId string [Required] The ID of the project containing this table.
statistics.query.referencedTables[].tableId string [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
statistics.query.schema nested object [Output-only, Experimental] The schema of the results. Present only for successful dry run of non-legacy SQL queries.
statistics.query.schema.fields[] list Describes the fields in a table.
statistics.query.schema.fields[].description string [Optional] The field description. The maximum length is 16K characters.
statistics.query.schema.fields[].fields[] list [Optional] Describes the nested schema fields if the type property is set to RECORD.
statistics.query.schema.fields[].mode string [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
statistics.query.schema.fields[].name string [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
statistics.query.schema.fields[].type string [Required] The field data type. Possible values include STRING, BYTES, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
statistics.query.totalBytesBilled long [Output-only] Total bytes billed for the job.
statistics.query.totalBytesProcessed long [Output-only] Total bytes processed for the job.
statistics.startTime long [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.
statistics.totalBytesProcessed long [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
status nested object [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
status.errorResult nested object [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful. For more information, see troubleshooting errors.
status.errorResult.debugInfo string Debugging information. This property is internal to Google and should not be used.
status.errorResult.location string Specifies where the error occurred, if present.
status.errorResult.message string A human-readable description of the error.
status.errorResult.reason string A short error code that summarizes the error. For help on debugging the specific reason value you receive, see troubleshooting errors.
status.errors[] list [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful. For more information, see troubleshooting errors.
status.errors[].debugInfo string Debugging information. This property is internal to Google and should not be used.
status.errors[].location string Specifies where the error occurred, if present.
status.errors[].message string A human-readable description of the error.
status.errors[].reason string A short error code that summarizes the error. For help on debugging the specific reason value you receive, see troubleshooting errors.
status.state string [Output-only] Running state of the job.
user_email string [Output-only] Email address of the user who ran the job.

Methods

The following methods are supported:

cancel
Requests 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. For more information, see pricing.
get
Returns 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.
getQueryResults
Retrieves the results of a query job.
insert
Starts a new asynchronous job. Requires the Can View project role.
list
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.
query
Runs a BigQuery SQL query and returns results if the query completes within a specified timeout.

Send feedback about...