Skip to content

Commit 367f46d

Browse files
[Python] Create temporary dataset with a 24 hour ttl. (#39615)
* Create temporary dataset with a 24 hour ttl. * Update sdks/python/apache_beam/io/gcp/bigquery_tools.py Co-authored-by: Jack McCluskey <34928439+jrmccluskey@users.noreply.github.com> --------- Co-authored-by: Jack McCluskey <34928439+jrmccluskey@users.noreply.github.com>
1 parent 8d24582 commit 367f46d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

sdks/python/apache_beam/io/gcp/bigquery_tools.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@
125125
"GEOGRAPHY": str,
126126
}
127127

128+
# Duplicated logic with io/gcp/bigquery_change_history.py
129+
# Default table expiration for auto-created temp datasets: 24 hours in ms.
130+
# Tables created in the dataset auto-expire after this duration if not
131+
# explicitly deleted, acting as a safety net for orphaned temp tables
132+
# (e.g. pipeline crash before cleanup runs).
133+
_DEFAULT_TABLE_EXPIRATION_MS = 24 * 60 * 60 * 1000
134+
128135

129136
class FileFormat(object):
130137
CSV = 'CSV'
@@ -952,6 +959,7 @@ def create_temporary_dataset(
952959
project_id,
953960
self.temp_dataset_id,
954961
location=location,
962+
default_table_expiration_ms=_DEFAULT_TABLE_EXPIRATION_MS,
955963
labels=labels,
956964
kms_key=kms_key)
957965

0 commit comments

Comments
 (0)