Skip to content

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

Description

@tswast

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.

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.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