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": "redacted@redacted.iam.gserviceaccount.com"
}
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.
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:
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
JobReferenceclass which includes shared job properties such asproject,job_id, anderrorswhich is used when there is aValueErrorwhen parsing a job resource.