Skip to content
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

Fix ReadAllFromBigQuery leak temp dataset #31895

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions sdks/python/apache_beam/io/gcp/bigquery_read_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import decimal
import json
import logging
import random
import secrets
import time
import uuid
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -255,7 +255,8 @@ def process(self,
if not table_reference.projectId:
table_reference.projectId = self._get_project()

schema, metadata_list = self._export_files(self.bq, element, table_reference)
schema, metadata_list = self._export_files(
self.bq, element, table_reference)

for metadata in metadata_list:
yield self._create_source(metadata.path, schema)
Expand Down Expand Up @@ -302,7 +303,7 @@ def _execute_query(
self._job_name,
self._source_uuid,
bigquery_tools.BigQueryJobTypes.QUERY,
'%s_%s' % (int(time.time()), random.randint(0, 1000)))
'%s_%s' % (int(time.time()), secrets.token_hex(3)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in alignment with

self.obj_id = '%d_%s' % (int(time.time()), secrets.token_hex(3))

likely the cause of #26343

job = bq._start_query_job(
self._get_project(),
element.query,
Expand Down
Loading