google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

BigQuery: get_job() and list_jobs() fail when there has been an invalid job request

Open tswast opened this issue 9 years ago • 3 comments

The list_job() function is failing on my project because it cannot parse an invalid timestamp.

Using the bigquery.jobs.get in the API explorer on the problematic job, I see the resource:

{
 "kind": "bigquery#job",
 "etag": "blah-blah-blah",
 "id": "redacted",
 "selfLink": "https://www.googleapis.com/bigquery/v2/projects/redacted/jobs/redacted",
 "jobReference": {
  "projectId": "redacted",
  "jobId": "redacted"
 },
 "configuration": {
  "query": {
   "query": "SELECT TIMESTAMP_ADD(@ts_value, INTERVAL 1 HOUR);",
   "useLegacySql": false,
   "parameterMode": "NAMED",
   "queryParameters": [
    {
     "name": "ts_value",
     "parameterType": {
      "type": "TIMESTAMP"
     },
     "parameterValue": {
      "value": "1.4810976E9"
     }
    }
   ]
  }
 },
 "status": {
  "state": "DONE",
  "errorResult": {
   "reason": "invalid",
   "message": "Unparseable query parameter `ts_value` in type `TYPE_TIMESTAMP`, Invalid timestamp: '1.4810976E9' value: '1.4810976E9'"
  },
  "errors": [
   {
    "reason": "invalid",
    "message": "Unparseable query parameter `ts_value` in type `TYPE_TIMESTAMP`, Invalid timestamp: '1.4810976E9' value: '1.4810976E9'"
   }
  ]
 },
 "statistics": {
  "creationTime": "1493056369841",
  "startTime": "1493056369857",
  "endTime": "1493056369857"
 },
 "user_email": "[email protected]"
}

As you can see, it is known that this job is invalid, but listing should not fail on projects with invalid jobs.

I propose creating a JobReference class which includes shared job properties such as project, job_id, and errors which is used when there is a ValueError when parsing a job resource.

tswast avatar Oct 24 '17 16:10 tswast

@alixhami Since this is labeled P1, may I ask the status on this and if I can help in any way?

@tswast I briefly looked at the issue but I'm not sure how to connect the JobReference class to everything else.

chemelnucfin avatar Jan 11 '18 07:01 chemelnucfin

@chemelnucfin I'm out of office right now, but I'm planning on fixing this by the end of next week.

alixhami avatar Jan 12 '18 19:01 alixhami

@alixhami Sorry to bother you! Have a good vacation.

chemelnucfin avatar Jan 12 '18 20:01 chemelnucfin