Skip to content

cannot perform query with parentheses #372

Description

@ef7475

Hello,
We are using gcloud with NodeJS server to perform queries a Google BigQuery db.
Our server runs on Amazon Beanstalk.

We are running the following query:

var bigquery = gcloud.bigquery({
  projectId: 'XXX',
  keyFilename: 'YYY'
});
var query = "SELECT COUNT(id) FROM AAA.BBB";
bigquery.query(query, function(err, rows) {
    if (err) {
      handleError(res,err);
    }
    else {
      res.send(200,rows);
    }
  });

it works fine on the development environment, but when installing on Beanstalk, we get the following error:

"errors": [
        {
            "domain": "global",
            "reason": "invalidQuery",
            "message": "Encountered \" \"%\" \"% \"\" at line 1, column 18.\nWas expecting:\n    <EOF> \n    ",
            "locationType": "other",
            "location": "query"
        }
    ],
    "code": 400,
    "message": "Encountered \" \"%\" \"% \"\" at line 1, column 18.\nWas expecting:\n    <EOF> \n    "

My guess is that somehow the parenthesis in the query are being escaped (because queries without parenthesis works ok). We cannot figure out how to solve this.

Your help will be appreciated.

Activity

  1. changed the title [-]cannot perform query with parentasis[/-] [+]cannot perform query with parentheses[/+] on Feb 2, 2015
  2. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Feb 2, 2015
  3. stephenplusplus commented on Feb 3, 2015

    @stephenplusplus
    Contributor

    I'm kind of lost on this one. The query is sent as a JSON payload in a POST request, so it's not being escaped. Since it's working locally but not in that environment, I'm not sure how to debug. Maybe @ryanseys has an idea.

  4. ryanseys commented on Feb 3, 2015

    @ryanseys
    Contributor

    I'll take a look at this.

  5. ef7475 commented on Feb 3, 2015

    @ef7475
    Author

    Same code appears to work without errors now.
    It seems that sometime this morning it was fixed somewhere. I wonder where?

  6. ryanseys commented on Feb 3, 2015

    @ryanseys
    Contributor

    Oh good! I was just firing up a beanstalk instance to investigate but AWS
    documentation is really intense. If I had to guess I'm going to say AWS is
    the culprit here considering it works on our local machine no problem and
    we've made no underlying changes to our library.

    On Tuesday, February 3, 2015, ef7475 [email protected] wrote:

    Same code appears to work without errors now.
    It seems that sometime this morning it was fixed somewhere. I wonder where?

    —
    Reply to this email directly or view it on GitHub
    #372 (comment)
    .

  7. added a commit that references this issue on Aug 22, 2022
  8. 30 remaining items

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

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: bigqueryIssues related to the BigQuery API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions