Skip to content

getMetadata: allow arbitrary request parameters #2684

@c0b

Description

@c0b

the REST API reference mentioned selectedFields [2], and all google cloud services support the fields parameter [3]; but from [1] I'm not seeing how can I pass these parameters?

  1. https://googlecloudplatform.github.io/google-cloud-node/#/docs/bigquery/0.9.6/bigquery/table?method=getMetadata
  2. https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/get
  3. https://developers.google.com/apis-explorer/#p/bigquery/v2/bigquery.tables.get

Background is we have some tens of thousands tables in bigquery want to figure out which ones are the most expensive ones (using the most storage), so write a little script to enumerate all table metadata, but it runs slow because each API call need to retrieve all metadata, want to use the fields to get only the needed information; if anyone knows a workaround, let me know.
(the http command here is an advanced version of curl; from https://httpie.org/)

$ access_token=$(gcloud auth application-default print-access-token)
$ http https://www.googleapis.com/bigquery/v2/projects/<projectId>/datasets/<datasetId>/tables/<tableId> \
 fields==id,numBytes,numLongTermBytes,numRows,creationTime,expirationTime,lastModifiedTime,type,location \
 access_token==$access_token
[...]
{
 "id": "<projectId>:<datasetId>.<tableId>",
 "numBytes": "112728076",
 "numLongTermBytes": "0",
 "numRows": "28431",
 "creationTime": "1505962477264",
 "expirationTime": "1513738477264",
 "lastModifiedTime": "1505962477264",
 "type": "TABLE",
 "location": "US"
}

Metadata

Metadata

Labels

api: bigqueryIssues related to the BigQuery API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions