Skip to content

Commit

Permalink
Support ValueProvider for _CustomBigQueryStorageSource (apache#30662)
Browse files Browse the repository at this point in the history
  • Loading branch information
liferoad authored and hjtran committed Apr 4, 2024
1 parent 758e010 commit bc1fcfb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sdks/python/apache_beam/io/gcp/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,16 @@ def estimate_size(self):
bq = bigquery_tools.BigQueryWrapper.from_pipeline_options(
self.pipeline_options)
if self.table_reference is not None:
return self._get_table_size(bq, self.table_reference)
table_ref = self.table_reference
if (isinstance(self.table_reference, vp.ValueProvider) and
self.table_reference.is_accessible()):
table_ref = bigquery_tools.parse_table_reference(
self.table_reference.get(), project=self._get_project())
elif isinstance(self.table_reference, vp.ValueProvider):
# Size estimation is best effort. We return None as we have
# no access to the table that we're querying.
return None
return self._get_table_size(bq, table_ref)
elif self.query is not None and self.query.is_accessible():
query_job_name = bigquery_tools.generate_bq_job_name(
self._job_name,
Expand Down

0 comments on commit bc1fcfb

Please sign in to comment.