Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

getMetadata: allow arbitrary request parameters #11

Description

@stephenplusplus

From @c0b on October 20, 2017 5:49

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"
}

Copied from original issue: googleapis/google-cloud-node#2684

Activity

  1. stephenplusplus commented on Nov 17, 2017

    @stephenplusplus
    ContributorAuthor

    From @c0b on October 20, 2017 6:58

    I see the fields parameter is the use case to mitigate the problem resolved by GraphQL API, but is it possible to ask google services to have GraphQL API?

  2. stephenplusplus commented on Nov 17, 2017

    @stephenplusplus
    ContributorAuthor

    From @callmehiphop on November 1, 2017 18:21

    @stephenplusplus I don't think it is very common for get/getMetadata to accept query parameters, however do you think we should add support for this in the common library?

  3. stephenplusplus commented on Nov 17, 2017

    @stephenplusplus
    ContributorAuthor

    I do! Best to be as raw as possible in the common layer.

  4. stephenplusplus commented on Nov 17, 2017

    @stephenplusplus
    ContributorAuthor

    From @tejohnso on November 2, 2017 22:41

    @c0b have you tried eg getMetadata({fields: "lastModifiedTime"})?
    It works in the storage module.

  5. stephenplusplus commented on Nov 17, 2017

    @stephenplusplus
    ContributorAuthor

    From @c0b on November 3, 2017 20:29

    no; I did try that do not work in @google-cloud/[email protected]; current getMetadata take one parameter only which is expected to be the callback function, if pass in an obj then the error is TypeError: callback is not a function

  6. stephenplusplus commented on Nov 17, 2017

    @stephenplusplus
    ContributorAuthor

    From @c0b on November 3, 2017 21:46

    @tejohnso the storage module works because of #2626 storage has its own repo that has support of that

    https://github.com/googleapis/nodejs-storage/search?q=getMetadata+path:src

  7. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed on Dec 22, 2018
  8. callmehiphop commented on Jul 15, 2019

    @callmehiphop
    Contributor

    I think this has since been resolved in the common repo. If anyone has any issues trying to send parameters via getMetadata methods, please let us know and we'll re-open!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/nodejs-bigquery API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions