I have created Google query job with my own job id successfully. And able to use the job id again and got successful results yesterday. But the same Job id not working fine. I have tried the job id with project Id in the google bigquery UI got the same error as '404' below
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found: Table<projectId:some random generated String.some random generated String>"
}
],
"code": 404,
"message": "Not Found: Table <projectId:some random generated String.some random generated String>
}
}
Please help me, is there any life time for Job? Or any specific Configuration required while creating Job Id to work permanently?
I am using Java API of Google Bigquery to do the above implementation. Find the logic used below: Query Job Creation logic:
String query = "SELECT count(*) AS TOTAL_RECORDS FROM :dataset.:tablename;"
String expectedJobId = "someuniqueString";
JobConfigurationQuery queryConfig = new JobConfigurationQuery()
.setQuery(query);
queryConfig.setUseQueryCache(true);
JobConfiguration config = new JobConfiguration()
.setQuery(queryConfig);
JobReference jobReference = new JobReference();
jobReference.setJobId(expectedJobId);
jobReference.setProjectId(PROJECT_ID);
Job job = new Job().setId(expectedJobId).setConfiguration(
config);
job.setJobReference(jobReference);
job = bigqueryService.jobs()
.insert(PROJECT_ID, job).execute();
Results Retrieved using above JobId :
GetQueryResults queryRequest = bigqueryService.jobs()
.getQueryResults(PROJECT_ID, expectedJobId);
GetQueryResultsResponse queryResponse = queryRequest.execute();