-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: use
jobs.getQueryResults
to download result sets (#363)
* refactor: break job into multiple modules Original paths are retained for backwards compatibility. * perf: use `jobs.getQueryResults` to download result sets Replaces `tabledata.list` when `RowIterator` is used for query results. This likely also fixes a few edge cases around BigQuery scripting jobs. * revert unnecessary changes to _get_query_results * simplify RowIterator. no need to hack Table object * fix tests for bqstorage warning * populate location
- Loading branch information
Showing
11 changed files
with
256 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ def _make_job_resource( | |
endpoint="https://bigquery.googleapis.com", | ||
job_type="load", | ||
job_id="a-random-id", | ||
location="US", | ||
project_id="some-project", | ||
user_email="[email protected]", | ||
): | ||
|
@@ -69,7 +70,11 @@ def _make_job_resource( | |
"statistics": {"creationTime": creation_time_ms, job_type: {}}, | ||
"etag": etag, | ||
"id": "{}:{}".format(project_id, job_id), | ||
"jobReference": {"projectId": project_id, "jobId": job_id}, | ||
"jobReference": { | ||
"projectId": project_id, | ||
"jobId": job_id, | ||
"location": location, | ||
}, | ||
"selfLink": "{}/bigquery/v2/projects/{}/jobs/{}".format( | ||
endpoint, project_id, job_id | ||
), | ||
|
@@ -130,7 +135,7 @@ def _table_ref(self, table_id): | |
|
||
return TableReference(self.DS_REF, table_id) | ||
|
||
def _make_resource(self, started=False, ended=False): | ||
def _make_resource(self, started=False, ended=False, location="US"): | ||
self._setUpConstants() | ||
return _make_job_resource( | ||
creation_time_ms=int(self.WHEN_TS * 1000), | ||
|
@@ -144,6 +149,7 @@ def _make_resource(self, started=False, ended=False): | |
job_id=self.JOB_ID, | ||
project_id=self.PROJECT, | ||
user_email=self.USER_EMAIL, | ||
location=location, | ||
) | ||
|
||
def _verifyInitialReadonlyProperties(self, job): | ||
|
Oops, something went wrong.