[ 
https://issues.apache.org/jira/browse/BEAM-3097?focusedWorklogId=415203&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-415203
 ]

ASF GitHub Bot logged work on BEAM-3097:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Apr/20 00:23
            Start Date: 03/Apr/20 00:23
    Worklog Time Spent: 10m 
      Work Description: chamikaramj commented on pull request #11244: 
[BEAM-3097] _ReadFromBigQuery supports valueprovider for table
URL: https://github.com/apache/beam/pull/11244#discussion_r402668608
 
 

 ##########
 File path: sdks/python/apache_beam/io/gcp/bigquery.py
 ##########
 @@ -641,12 +641,19 @@ def __init__(
   def estimate_size(self):
     bq = bigquery_tools.BigQueryWrapper()
     if self.table_reference is not None:
+      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(), self.dataset, self.project)
+      elif isinstance(self.table_reference, vp.ValueProvider):
+        # Size estimation is best effort. We return 0 as we have no
+        # access to the table that we're querying.
+        return 0
       table = bq.get_table(
-          self.table_reference.projectId,
-          self.table_reference.datasetId,
-          self.table_reference.tableId)
+          table_ref.projectId, table_ref.datasetId, table_ref.tableId)
       return int(table.numBytes)
-    else:
+    elif self.query is not None and self.query.is_accessible():
 
 Review comment:
   Shouldn't we support ValueProvider for queries as well ?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 415203)
    Remaining Estimate: 0.5h  (was: 40m)
            Time Spent: 1.5h  (was: 1h 20m)

> Allow BigQuerySource to take a ValueProvider as a table input.
> --------------------------------------------------------------
>
>                 Key: BEAM-3097
>                 URL: https://issues.apache.org/jira/browse/BEAM-3097
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-py-core
>            Reporter: Ed Mothershaw
>            Priority: Minor
>   Original Estimate: 2h
>          Time Spent: 1.5h
>  Remaining Estimate: 0.5h
>
> In file sdks/python/apache_beam/io/gcp/bigquery.py, class BigQuery, line 389. 
> When a ValueProvider is input as table the script will fail.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to