Content-Length: 421417 | pFad | https://github.com/googleapis/python-bigquery/commit/22b80bba9d0bed319fd3102e567906c9b458dd02

8B feat: add preview support for incremental results (#2145) · googleapis/python-bigquery@22b80bb · GitHub
Skip to content

Commit 22b80bb

Browse files
authored
feat: add preview support for incremental results (#2145)
* feat: add preview support for incremental results Plumbs support to enable incremental results. * fastpath allow * add fastquery test * lint * lint * blacken
1 parent ae632c5 commit 22b80bb

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

google/cloud/bigquery/_job_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ def _supported_by_jobs_query(request_body: Dict[str, Any]) -> bool:
564564
"maximumBytesBilled",
565565
"requestId",
566566
"createSession",
567+
"writeIncrementalResults",
567568
}
568569

569570
unsupported_keys = request_keys - keys_allowlist

google/cloud/bigquery/job/query.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,21 @@ def write_disposition(self):
674674
def write_disposition(self, value):
675675
self._set_sub_prop("writeDisposition", value)
676676

677+
@property
678+
def write_incremental_results(self) -> Optional[bool]:
679+
"""This is only supported for a SELECT query using a temporary table.
680+
681+
If set, the query is allowed to write results incrementally to the temporary result
682+
table. This may incur a performance penalty. This option cannot be used with Legacy SQL.
683+
684+
This feature is not generally available.
685+
"""
686+
return self._get_sub_prop("writeIncrementalResults")
687+
688+
@write_incremental_results.setter
689+
def write_incremental_results(self, value):
690+
self._set_sub_prop("writeIncrementalResults", value)
691+
677692
@property
678693
def table_definitions(self):
679694
"""Dict[str, google.cloud.bigquery.external_config.ExternalConfig]:

tests/unit/job/test_query_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ def test_connection_properties(self):
167167
self.assertEqual(config.connection_properties[1].key, "time_zone")
168168
self.assertEqual(config.connection_properties[1].value, "America/Chicago")
169169

170+
def test_incremental_results(self):
171+
config = self._get_target_class()()
172+
config.write_incremental_results = True
173+
self.assertEqual(config.write_incremental_results, True)
174+
170175
def test_create_session(self):
171176
config = self._get_target_class()()
172177
self.assertIsNone(config.create_session)

tests/unit/test__job_helpers.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ def make_query_response(
194194
make_query_request({"maximumBytesBilled": "987654"}),
195195
id="job_config-with-maximum_bytes_billed",
196196
),
197+
pytest.param(
198+
job_query.QueryJobConfig(
199+
write_incremental_results=True,
200+
),
201+
make_query_request({"writeIncrementalResults": True}),
202+
id="job_config-with-incremental-results",
203+
),
197204
),
198205
)
199206
def test__to_query_request(job_config, expected):
@@ -1141,6 +1148,11 @@ def test_make_job_id_w_job_id_overrides_prefix():
11411148
False,
11421149
id="priority=BATCH",
11431150
),
1151+
pytest.param(
1152+
job_query.QueryJobConfig(write_incremental_results=True),
1153+
True,
1154+
id="write_incremental_results",
1155+
),
11441156
),
11451157
)
11461158
def test_supported_by_jobs_query_from_queryjobconfig(

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/python-bigquery/commit/22b80bba9d0bed319fd3102e567906c9b458dd02

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy