feat: add preview support for incremental results by shollyman · Pull Request #2145 · googleapis/python-bigquery · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

feat: add preview support for incremental results #2145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions google/cloud/bigquery/_job_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ def _supported_by_jobs_query(request_body: Dict[str, Any]) -> bool:
"maximumBytesBilled",
"requestId",
"createSession",
"writeIncrementalResults",
}

unsupported_keys = request_keys - keys_allowlist
Expand Down
15 changes: 15 additions & 0 deletions google/cloud/bigquery/job/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,21 @@ def write_disposition(self):
def write_disposition(self, value):
self._set_sub_prop("writeDisposition", value)

@property
def write_incremental_results(self) -> Optional[bool]:
"""This is only supported for a SELECT query using a temporary table.

If set, the query is allowed to write results incrementally to the temporary result
table. This may incur a performance penalty. This option cannot be used with Legacy SQL.

This feature is not generally available.
"""
return self._get_sub_prop("writeIncrementalResults")

@write_incremental_results.setter
def write_incremental_results(self, value):
self._set_sub_prop("writeIncrementalResults", value)

@property
def table_definitions(self):
"""Dict[str, google.cloud.bigquery.external_config.ExternalConfig]:
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/job/test_query_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ def test_connection_properties(self):
self.assertEqual(config.connection_properties[1].key, "time_zone")
self.assertEqual(config.connection_properties[1].value, "America/Chicago")

def test_incremental_results(self):
config = self._get_target_class()()
config.write_incremental_results = True
self.assertEqual(config.write_incremental_results, True)

def test_create_session(self):
config = self._get_target_class()()
self.assertIsNone(config.create_session)
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/test__job_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ def make_query_response(
make_query_request({"maximumBytesBilled": "987654"}),
id="job_config-with-maximum_bytes_billed",
),
pytest.param(
job_query.QueryJobConfig(
write_incremental_results=True,
),
make_query_request({"writeIncrementalResults": True}),
id="job_config-with-incremental-results",
),
),
)
def test__to_query_request(job_config, expected):
Expand Down Expand Up @@ -1141,6 +1148,11 @@ def test_make_job_id_w_job_id_overrides_prefix():
False,
id="priority=BATCH",
),
pytest.param(
job_query.QueryJobConfig(write_incremental_results=True),
True,
id="write_incremental_results",
),
),
)
def test_supported_by_jobs_query_from_queryjobconfig(
Expand Down

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.