Method: tabledata.insertAll

Streams data into BigQuery one record at a time without needing to run a load job. A few minor differences between these 2 APIs: (1) InsertAllRequest.kind has default value "bigquery#tableDataInsertAllRequest" in the Apiary definition. But proto3 doesn't support string literal default value for string. Fortunately we don't really check that field anyway. (2) boolean value 'skipInvalidRows' and 'ignoreUnknownValues' can be unset in our existing system. In proto3, they are default to false. Fortunately the existing behavior treats unset as false by default. But this does restrict us to stick with the existing default behavior. (3) Unlike Apiary, there's no way to provide customized http error reason string. Since we can still return the same http code, this shouldn't be much trouble.

HTTP request

POST https://bigquery.googleapis.com/bigquery/v2/projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
projectId

string

datasetId

string

tableId

string

Request body

The request body contains data with the following structure:

JSON representation
{
  "kind": [
    string
  ],
  "skipInvalidRows": boolean,
  "ignoreUnknownValues": boolean,
  "templateSuffix": string,
  "rows": [
    {
      object (InsertionRow)
    }
  ]
}
Fields
kind[]

string

skipInvalidRows

boolean

ignoreUnknownValues

boolean

templateSuffix

string

rows[]

object (InsertionRow)

Response body

If successful, the response body contains data with the following structure:

JSON representation
{
  "kind": string,
  "insertErrors": [
    {
      object (InsertionError)
    }
  ]
}
Fields
kind

string

insertErrors[]

object (InsertionError)

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/bigquery
  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/bigquery.insertdata

For more information, see the Authentication Overview.

InsertionRow

JSON representation
{
  "insertId": string,
  "json": {
    object
  }
}
Fields
insertId

string

json

object (Struct format)

InsertionError

JSON representation
{
  "index": number,
  "errors": [
    {
      object (ErrorProto)
    }
  ]
}
Fields
index

number (uint32 format)

errors[]

object (ErrorProto)

Try it!

Cette page vous a-t-elle été utile ? Évaluez-la :

Envoyer des commentaires concernant…