You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "riteshghorse (via GitHub)" <gi...@apache.org> on 2023/06/16 16:17:03 UTC

[GitHub] [beam] riteshghorse commented on a diff in pull request #27080: [TOB] add work example

riteshghorse commented on code in PR #27080:
URL: https://github.com/apache/beam/pull/27080#discussion_r1232444969


##########
learning/tour-of-beam/learning-content/io/big-query-io/read-table/python-example/task.py:
##########
@@ -26,35 +28,42 @@
 #     - hellobeam
 
 import argparse
+import os
+import warnings
+
 import apache_beam as beam
-from apache_beam.io import ReadFromText
-from apache_beam.io import WriteToBigQuery
-from apache_beam.options.pipeline_options import PipelineOptions
-from apache_beam.options.pipeline_options import SetupOptions
+from apache_beam.options.pipeline_options import PipelineOptions, GoogleCloudOptions, SetupOptions
+#from google.cloud import bigquery
+from apache_beam.io.gcp.bigquery import ReadFromBigQueryRequest, ReadAllFromBigQuery
+
+class WeatherData:
+    def __init__(self, station_number, wban_number, year, month, day):
+        self.station_number = station_number
+        self.wban_number = wban_number
+        self.year = year
+        self.month = month
+        self.day = day
 
+    def __str__(self):
+        return f"Weather Data: Station {self.station_number} (WBAN {self.wban_number}), Date: {self.year}-{self.month}-{self.day}"
 
 def run(argv=None):
     parser = argparse.ArgumentParser()
-    parser.add_argument('--input',
-                        dest='input',
-                        default='gs://bucket',
-                        help='Input file to process.')
 
     known_args, pipeline_args = parser.parse_known_args(argv)
 
     pipeline_options = PipelineOptions(pipeline_args)
-    pipeline_options.view_as(SetupOptions).save_main_session = True
+    pipeline_options.view_as(PipelineOptions)

Review Comment:
   what are you intending to do with this statement?



##########
learning/tour-of-beam/learning-content/io/big-query-io/read-table/java-example/Task.java:
##########
@@ -33,38 +35,42 @@
 import org.apache.beam.sdk.io.gcp.bigquery.BigQueryOptions;
 import org.apache.beam.sdk.options.PipelineOptions;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
-import org.apache.beam.sdk.transforms.DoFn;
-import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.*;

Review Comment:
   To keep things clean I would recommend not using `.*` instead specific packages. 
   May be someone from from java side can tell @Abacn 



##########
learning/tour-of-beam/learning-content/io/big-query-io/read-table/python-example/task.py:
##########
@@ -26,35 +28,42 @@
 #     - hellobeam
 
 import argparse
+import os
+import warnings
+
 import apache_beam as beam
-from apache_beam.io import ReadFromText
-from apache_beam.io import WriteToBigQuery
-from apache_beam.options.pipeline_options import PipelineOptions
-from apache_beam.options.pipeline_options import SetupOptions
+from apache_beam.options.pipeline_options import PipelineOptions, GoogleCloudOptions, SetupOptions
+#from google.cloud import bigquery

Review Comment:
   okay to remove the comment import if we are not using it



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org