ahmedabu98 commented on code in PR #26889:
URL: https://github.com/apache/beam/pull/26889#discussion_r1240017613


##########
sdks/python/apache_beam/examples/snippets/snippets.py:
##########
@@ -1212,6 +1220,50 @@ def table_fn(element, fictional_characters):
   # [END model_bigqueryio_time_partitioning]
 
 
+def model_bigqueryio_xlang(
+    pipeline, write_project='', write_dataset='', write_table=''):
+  """Examples for cross-language BigQuery sources and sinks."""
+
+  table_spec = 'clouddataflow-readonly:samples.weather_stations'
+  if write_project and write_dataset and write_table:
+    table_spec = '{}:{}.{}'.format(write_project, write_dataset, write_table)
+
+  # [START model_bigqueryio_write_schema]
+  table_schema = {
+      'fields': [{
+          'name': 'source', 'type': 'STRING', 'mode': 'NULLABLE'
+      }, {
+          'name': 'quote', 'type': 'STRING', 'mode': 'REQUIRED'
+      }]
+  }
+  # [END model_bigqueryio_write_schema]
+
+  quotes = pipeline | beam.Create([
+      {
+          'source': 'Mahatma Gandhi', 'quote': 'My life is my message.'
+      },
+      {
+          'source': 'Yoda', 'quote': "Do, or do not. There is no 'try'."
+      },
+  ])
+
+  # [START model_bigqueryio_storage_write_api_with_frequency]
+  # The SDK for Python does not support `withNumStorageWriteApiStreams`

Review Comment:
   ```suggestion
     # The Python SDK does not currently support setting the number of write 
streams
   ```



##########
sdks/python/apache_beam/examples/snippets/snippets_test.py:
##########
@@ -754,6 +755,13 @@ def test_model_bigqueryio(self):
       p.options.view_as(GoogleCloudOptions).temp_location = 'gs://mylocation'
       snippets.model_bigqueryio(p)
 
+  @pytest.mark.uses_gcp_java_expansion_service
+  @unittest.skipUnless(
+      os.environ.get('EXPANSION_PORT'),
+      "EXPANSION_PORT environment var is not provided.")
+  def test_model_bigqueryio_xlang(self):
+    pass

Review Comment:
   ```suggestion
       p = TestPipeline()
       p.options.view_as(GoogleCloudOptions).temp_location = 'gs://mylocation'
       snippets.model_bigqueryio_xlang(p)
   ```
   The xlang test should run the storage write pipeline ^



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to