Google BigQuery · Schema

Google BigQuery Query Request

Schema for a BigQuery query request, used to execute SQL queries against BigQuery datasets.

AnalyticsBig DataCloudData WarehouseServerlessSQL

Properties

Name Type Description
query string A query string to execute, using GoogleSQL or legacy SQL syntax
maxResults integer The maximum number of rows of data to return per page of results
defaultDataset object The default dataset to use for unqualified table names in the query
useLegacySql boolean Whether to use legacy SQL dialect. If false, uses GoogleSQL.
timeoutMs integer How long to wait for the query to complete, in milliseconds
dryRun boolean If set to true, BigQuery does not run the job but instead returns statistics about the job
useQueryCache boolean Whether to look for the result in the query cache
parameterMode string Standard SQL only. Set to POSITIONAL to use positional query parameters or NAMED for named parameters.
queryParameters array Query parameters for GoogleSQL queries
View JSON Schema on GitHub

JSON Schema

google-bigquery-query-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cloud.google.com/schemas/bigquery/query.json",
  "title": "Google BigQuery Query Request",
  "description": "Schema for a BigQuery query request, used to execute SQL queries against BigQuery datasets.",
  "type": "object",
  "required": ["query"],
  "properties": {
    "query": {
      "type": "string",
      "description": "A query string to execute, using GoogleSQL or legacy SQL syntax",
      "minLength": 1
    },
    "maxResults": {
      "type": "integer",
      "description": "The maximum number of rows of data to return per page of results",
      "minimum": 0
    },
    "defaultDataset": {
      "$ref": "#/$defs/DatasetReference",
      "description": "The default dataset to use for unqualified table names in the query"
    },
    "useLegacySql": {
      "type": "boolean",
      "description": "Whether to use legacy SQL dialect. If false, uses GoogleSQL.",
      "default": false
    },
    "timeoutMs": {
      "type": "integer",
      "description": "How long to wait for the query to complete, in milliseconds",
      "minimum": 0
    },
    "dryRun": {
      "type": "boolean",
      "description": "If set to true, BigQuery does not run the job but instead returns statistics about the job",
      "default": false
    },
    "useQueryCache": {
      "type": "boolean",
      "description": "Whether to look for the result in the query cache",
      "default": true
    },
    "parameterMode": {
      "type": "string",
      "description": "Standard SQL only. Set to POSITIONAL to use positional query parameters or NAMED for named parameters.",
      "enum": ["POSITIONAL", "NAMED"]
    },
    "queryParameters": {
      "type": "array",
      "description": "Query parameters for GoogleSQL queries",
      "items": {
        "$ref": "#/$defs/QueryParameter"
      }
    }
  },
  "$defs": {
    "DatasetReference": {
      "type": "object",
      "description": "A reference to a BigQuery dataset",
      "properties": {
        "projectId": {
          "type": "string",
          "description": "The ID of the project containing the dataset"
        },
        "datasetId": {
          "type": "string",
          "description": "The ID of the dataset"
        }
      }
    },
    "QueryParameter": {
      "type": "object",
      "description": "A query parameter for parameterized queries",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of this parameter. Used for named parameters only."
        },
        "parameterType": {
          "type": "object",
          "description": "The type of this parameter",
          "properties": {
            "type": {
              "type": "string",
              "description": "The data type",
              "enum": ["STRING", "INT64", "FLOAT64", "NUMERIC", "BIGNUMERIC", "BOOL", "BYTES", "DATE", "DATETIME", "GEOGRAPHY", "TIME", "TIMESTAMP", "ARRAY", "STRUCT"]
            }
          }
        },
        "parameterValue": {
          "type": "object",
          "description": "The value of this parameter",
          "properties": {
            "value": {
              "type": "string",
              "description": "The value of this parameter"
            }
          }
        }
      }
    }
  }
}