Skip to content

Not able to implement Big Query cancel job #1027

Description

@peterwillis

The cancel job function is not implemented for big query so I went about putting together a pull request. It should be straight forward but it's not because the url structure for all the other job api calls are slightly different...

To cancel a job:
POST https://www.googleapis.com/bigquery/v2/project/projectId/jobs/jobId/cancel

This is the correct URL because it works on the documentation site through the try it tester.

All the others have a pluralised 'projects' rather than 'project':
GET https://www.googleapis.com/bigquery/v2/projects/projectId/jobs/jobId
POST https://www.googleapis.com/bigquery/v2/projects/projectId/queries
GET https://www.googleapis.com/bigquery/v2/projects/projectId/jobs
...etc

I don't think this could be neatly worked around for the purposes of this library because that part of the url is baked into the service class. Is this a mistake in the Big Query REST api? If so where should I raise that issue?

Activity

  1. stephenplusplus commented on Dec 17, 2015

    @stephenplusplus
    Contributor

    Yikes, that's weird.

    Is this a mistake in the Big Query REST api? If so where should I raise that issue?

    @jgeewax?

    If we have to get around it, we can use request interceptors, something like:

    function Job() {
      this.interceptors.push({
        request: function(reqOpts) {
          if (reqOpts.uri.indexOf('/cancel') > -1) {
            reqOpts.uri = reqOpts.uri.replace('/projects/', '/project/');
          }
          return reqOpts;
        }
      });
    }

    *edit for code

  2. stephenplusplus commented on Dec 17, 2015

    @stephenplusplus
    Contributor
  3. jgeewax commented on Dec 18, 2015

    @jgeewax
    Contributor

    Yikes. I'm asking around.

    Regardless of why this weirdness is here, we should be able to fix it by having both /project/ and /projects/ do the same thing.. That way we don't break any legacy folks, and we don't have to add our hack -- however, that is super clever @stephenplusplus :)

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

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