Skip to main content

tabledata

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

Overview​

Nametabledata
TypeResource
Idgoogle.bigquery.tabledata

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
etagstringA hash of this page of results.
kindstringThe resource type of the response. (default: bigquery#tableDataList)
pageTokenstringA token used for paging results. Providing this token instead of the startIndex parameter can help you retrieve stable results when an underlying table is changing.
rowsarrayRows of results.
totalRowsstring (int64)Total rows of the entire table. In order to show default value 0 we have to present it as string.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectprojectId, datasetId, tableIdformatOptions.timestampOutputFormat, formatOptions.useInt64Timestamp, maxResults, pageToken, selectedFields, startIndexList the content of a table in rows. # IAM Permissions Requires the bigquery.tables.getData permission on the table.
insert_allinsertprojectId, datasetId, tableIdStreams data into BigQuery one record at a time without needing to run a load job. # IAM Permissions Requires the following IAM permission(s) to use this method: - bigquery.tables.updateData on the table. - bigquery.tables.get on the table. - bigquery.datasets.get on the dataset.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
datasetIdstring
projectIdstring
tableIdstring
formatOptions.timestampOutputFormatstring
formatOptions.useInt64Timestampboolean
maxResultsinteger (uint32)
pageTokenstring
selectedFieldsstring
startIndexstring (uint64)

SELECT examples​

List the content of a table in rows. # IAM Permissions Requires the bigquery.tables.getData permission on the table.

SELECT
etag,
kind,
pageToken,
rows,
totalRows
FROM google.bigquery.tabledata
WHERE projectId = '{{ projectId }}' -- required
AND datasetId = '{{ datasetId }}' -- required
AND tableId = '{{ tableId }}' -- required
AND formatOptions.timestampOutputFormat = '{{ formatOptions.timestampOutputFormat }}'
AND formatOptions.useInt64Timestamp = '{{ formatOptions.useInt64Timestamp }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND selectedFields = '{{ selectedFields }}'
AND startIndex = '{{ startIndex }}'
;

INSERT examples​

Streams data into BigQuery one record at a time without needing to run a load job. # IAM Permissions Requires the following IAM permission(s) to use this method: - bigquery.tables.updateData on the table. - bigquery.tables.get on the table. - bigquery.datasets.get on the dataset.

INSERT INTO google.bigquery.tabledata (
data__ignoreUnknownValues,
data__kind,
data__rows,
data__skipInvalidRows,
data__templateSuffix,
data__traceId,
projectId,
datasetId,
tableId
)
SELECT
{{ ignoreUnknownValues }},
'{{ kind }}',
'{{ rows }}',
{{ skipInvalidRows }},
'{{ templateSuffix }}',
'{{ traceId }}',
'{{ projectId }}',
'{{ datasetId }}',
'{{ tableId }}'
RETURNING
insertErrors,
kind
;