KevinGG commented on a change in pull request #15647:
URL: https://github.com/apache/beam/pull/15647#discussion_r721808069



##########
File path: sdks/python/apache_beam/runners/interactive/sql/beam_sql_magics.py
##########
@@ -181,11 +196,22 @@ def beam_sql(self, line: str, cell: Optional[str] = None) 
-> Optional[PValue]:
     if not query:
       on_error('Please supply the SQL query to be executed.')
       return
+    if runner and runner not in _SUPPORTED_RUNNERS:
+      on_error(
+          'Runner "%s" is not supported. Supported runners are %s.',
+          runner,
+          _SUPPORTED_RUNNERS)
     query = ' '.join(query)
 
-    found = find_pcolls(query, pcoll_by_name(), verbose=verbose)
+    found = find_pcolls(
+        query,
+        pcoll_by_name(),
+        run=runner in ('DirectRunner', None),
+        verbose=verbose)
+    schemas = set()
+    main_session = importlib.import_module('__main__')

Review comment:
       It's used below in a for-loop, put it here to only import it once.

##########
File path: sdks/python/apache_beam/runners/interactive/sql/utils_test.py
##########
@@ -81,5 +73,35 @@ def test_pformat_namedtuple(self):
         'ANamedTuple(a: int, b: str)', pformat_namedtuple(ANamedTuple))
 
 
[email protected](
+    not ie.current_env().is_interactive_ready,
+    '[interactive] dependency is not installed.')
[email protected](
+    not ie.current_env().is_interactive_ready,
+    reason='[interactive] dependency is not installed.')
+class OptionsFormTest(unittest.TestCase):
+  def test_dataflow_options_form(self):
+    p = beam.Pipeline()
+    pcoll = p | beam.Create([1, 2, 3])
+    with patch('google.auth') as ga:
+      ga.default = lambda: ['', 'default_project_id']
+      df_form = DataflowOptionsForm('pcoll', pcoll)
+      df_form.display_for_input()
+      df_form.entries[2].input.value = 'gs://test-bucket'
+      df_form.entries[3].input.value = 'a-pkg'
+      options = df_form.to_options()
+      self.assertEqual(
+          options.view_as(GoogleCloudOptions).project, 'default_project_id')
+      self.assertEqual(
+          options.view_as(GoogleCloudOptions).region, 'us-central1')
+      self.assertEqual(
+          options.view_as(GoogleCloudOptions).staging_location,
+          'gs://test-bucket/staging')
+      self.assertEqual(
+          options.view_as(GoogleCloudOptions).temp_location,
+          'gs://test-bucket/temp')

Review comment:
       Acked.




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